Forum Moderators: phranque

Message Too Old, No Replies

Entire site in the center of any browser.

http://www.cnet.com

         

engasi

5:34 pm on Feb 11, 2004 (gmt 0)

10+ Year Member



Hi All,

We want create a site and all pages are in the center of any browsers. Something like [cnet.com....] I read their source and found they are using:

<html>
<head>
...
</head>
<body>
<div align="center">
...........
...........
</div>
</body>
</html>

Is <div align="center"> the way to make entire site in center?

Thanks.

garann

6:05 pm on Feb 11, 2004 (gmt 0)

10+ Year Member



Yes, <div align="center"> will center your DIV on the page, but the align attribute for DIV is deprecated (W3C reference [w3.org]).
You could do something like this, instead, to accomplish a similar effect:

<div style="width: 600px; margin: 0 auto;"> ...

engasi

7:33 pm on Feb 11, 2004 (gmt 0)

10+ Year Member



Thank you very much. Another question: Can I just use

<Center>
..............
</center>

The webmasterworld.com seems using this method. Please correct me if I am wrong. Thanks again.

garann

12:07 am on Feb 12, 2004 (gmt 0)

10+ Year Member



Like <div align="center">, <center> will work in most browsers I know of. Also like <div align="center">, it's been deprecated by the W3C.

..So, you can use either of those methods, but by doing so you're just guaranteeing yourself that you'll have to go back and edit all your pages when the W3C standards are more strongly enforced. Centering your content using the margins is intended to save you some time down the road.