Click to See Complete Forum and Search --> : How to center site in web browser


irishdan
08-27-2003, 08:25 AM
My website is optimized for 800x600 resolution, so when its viewed with higher ones eg: 1024x768, 1280x1024, the site hugs the left margin of the browser. How can I center the page so its in the center of the browser, no matter what resolution?

Thanks

Khalid Ali
08-27-2003, 08:38 AM
you can use CSS property text-align:center

to center the contents....

There are some other approaches,like,using center tag and usign div tag with align=center attribute,however they are not approved by w3c standards any more...

LWL
08-27-2003, 08:43 AM
If you use tables in your website, the best way to center all the content is to put all the tables with content in outer ‘container’ table and to set the alignment of the cell to 'center':

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top">the content table</td>
</tr>
</table>
</body>