I have been trying to centre this site but had no luck. There seems to be a lot of conflicting info on the web over how best to do it. I am new to html and a little confused. If anyone knows that'd be great. Here is the code for anyone to have a go on. Cheers for any help. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>AllScoresNow - The Web's Greatest Live Sports Scores Site</title> <meta name="description" content="Live" sports="" scores="" updated="" by="" the="" minute="" soccer="" football="" baseball="" basketball="" handball="" plus="" free="" betting="" offers="" and="" odds=""> <link> <meta> </head> <body style="width: 931px;"> <table style="text-align: left; height: 121px; width: 929px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; vertical-align: bottom; width: 927px;"> <a href="http://www.allscoresnow.com/"><span style="text-decoration: underline;"><img style="border: 0px solid ; width: 486px; height: 88px;" alt="" src="logo.jpg"></span></a> <a href="www.allscoresnow.com"><img style="border: 0px solid ; width: 49px; height: 19px;" alt="" src="home.jpg" align="middle"></a> <a href="http://www.allscoresnow.com/aboutus"><span style="text-decoration: underline;"><img style="border: 0px solid ; width: 70px; height: 19px;" alt="" src="aboutusgrey.png" align="middle"></span></a> <a href="mailto:info@allscoresnow.com"><span style="text-decoration: underline;"><img style="border: 0px solid ; width: 61px; height: 19px;" alt="" src="contactgrey.png" align="middle"></span></a><br> <img style="width: 926px; height: 18px;" alt="" src="barsmall.jpg"></td> </tr> </tbody> </table> <table style="text-align: left; width: 929px; height: 1856px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; vertical-align: top; width: 806px; height: 1860px;"> <table style="text-align: left; height: 264px; width: 800px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td style="white-space: nowrap; width: 532px; height: 262px; vertical-align: top; text-align: left;"><img style="width: 493px; height: 18px;" alt="" src="bettingoffers.jpg" align="top"><br> <map name="offersbox"> <area shape="rect" coords="2,164,493,232" href="http://ads.betfair.com/redirect.aspx?pid=5701&bid=1847"> <area shape="rect" coords="1,87,493,157" href="http://www.bet365.com/home/default.asp?affiliate=365_016876&lng=1&oty=1&tzi=1"> <area shape="rect" coords="0,10,493,80" href="http://boylesportsreklame.com/ovuda.asp?AffID=854&BanID=202&bu=31&Affhrefadd=betting%2F%3Fgi%3D4%26fimsced%3D30%26fimsoec%3D1"> <area shape="default" coords="0,0,493,232" nohref=""> </map> <img src="offersbox.png" usemap="#offersbox" border="0" height="232" width="493"> <img alt="" src="offersbox.psd"><br> </td> <td style="white-space: nowrap; vertical-align: top; text-align: right; height: 262px; width: 302px;"><a href="http://ads.betfair.com/redirect.aspx?pid=5701&bid=1558"><img src="http://ads.betfair.com/renderImage.aspx?pid=5701&bid=1558" border="0"></a></td> </tr> </tbody> </table> <img style="width: 799px; height: 18px;" alt="" src="scores.gif" align="top"><br> <iframe src="http://www.livescore.betradar.com/livescore/mybet/?language=en" name="myInlineFrame" align="left" frameborder="0" height="1520" scrolling="auto" width="800">Your Brower Does Not Support iFrame</iframe> </td> <td style="white-space: nowrap; vertical-align: top; width: 123px; height: 1880px;"><a href="http://boylesportsreklame.com/ovuda.asp?AffID=854&BanID=402&bu=31&Affhrefadd=%2F%3Ffimsced%3D30%26fimsoec%3D1"><img src="http://boylesportsreklame.com/evena.asp?AffID=854&BanID=402&b=402%2Egif" border="0" height="600" width="120"></a><br> <img style="border: 0px solid ; width: 120px; height: 600px;" alt="" src="http://images.bet365affiliates.com/Channel.aspx?CID=83&LnkID=365_016876&oty=1&lng=1" align="top"><br> <a href="http://ads.betfair.com/redirect.aspx?pid=5701&bid=1880"><img src="http://ads.betfair.com/renderImage.aspx?pid=5701&bid=1880" border="0"></a></td> </tr> </tbody> </table> <div style="text-align: center; margin-top: 0px; height: 16px;"><span style="font-family: Helvetica,Arial,sans-serif;"></span> <hr style="width: 100%; height: 2px;"><span style="font-family: Helvetica,Arial,sans-serif;"><br> Copywrite © 2008 AllScoresNow<br> <br> <br> </span></div> </body> </html>
Put it all in a wrapper div, and in the css place a width to the div and margin:auto; it. So like this (although your code is really bad, i'd recomend recoding the whole thing so it actually validates, if you want I could do it for a small fee):
ok thanks for this. The code may well be pretty bad. I am very new to this. I tw as just done with Kompozer, so i didn't actually cod it myself, it was all generated. How does bad code affect a site though? I mean presumably it functions the same?
Bad code can make it work differently in different browsers, it doesn't keep your code safe for new/old versions of browsers, it makes the page less accessible (by screen readers used by visually impaired people for example), there are arguements that it affects your search engine position due to spiders having trouble scanning the site, i'm sure there are more reasons.
Quote: Originally Posted by twistedspikes Put it all in a wrapper div, and in the css place a width to the div and margin:auto; it. Right there.. that would be the easiest way.