Centering your sites in the browser!

windows

Guest
OK, the best way to get your site centered in the browser window is to have a containg table (coloured green) and inside that table have your site (table coloured red). Check out the code below. I've coloured the table backgrounds to make it easier. Also the inner table size is set to 760x408 which will not give any scroll bars when viewed at 800x600. Personally I hate horizontal scroll bars with a pashion! Vertical scroll bars are ok as long as the page isn't 2 miles long... users would get fed up with scrolling!<br />
<br />
Hope this helps!<br />
<br />
<html><br />
<head><br />
<title>WHATEVER</title><br />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><br />
</head><br />
<br />
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><br />
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#999900"><br />
<tr><br />
<td align="center" valign="middle"><table width="760" height="408" border="0" cellpadding="0" cellspacing="0" bgcolor="#3366CC"><br />
<tr><br />
<td align="center" valign="middle">THIS WOULD BE YOUR WEBSITE</td><br />
</tr><br />
</table></td><br />
</tr><br />
</table><br />
</body><br />
</html><!--content-->If you are centering a site that is always centered, that can be messed up as well at certain viewing angles. The best way is to stick your table inside the code below so it stays centered.<br />
<br />
<html><br />
<body><br />
<div align="center"><br />
<!--table goes here--><br />
</div><br />
</body><br />
</html><br />
<br />
With that, you don't have to have multiple tables and all the extra code aligning the outer table.<!--content--><div style="margin: auto;"> should do it.<!--content-->
 
Back
Top