Forum Moderators: open
Please help. Thanks
[edited by: encyclo at 9:55 pm (utc) on Aug. 4, 2006]
[edit reason]
[1][edit reason] No personal URLs please, see forum charter [/edit] [/edit][/1]
Posting URLs is not permitted, and will be deleted by an op. See the TOS [webmasterworld.com].
There are several pretty glaring problems with your pages, including multiple <body> elements. You should validate your html [validator.w3.org] and css [jigsaw.w3.org].
That said, the correct way to center a content block is like so:
<body>
<div id="container">
...
</div>
</body>
In this example, the div with the id of "container" is what we want to make centered and fixed width. Now for the CSS:
body
{
margin: 0;
padding: 0;
text-align: center;
}
#container
{
margin: 0 auto;
width: 767px; /* or whatever fixed width you want */
}
Note, the key is this line:
margin: 0 auto;
That means a top and bottom margin of 0, and a left and right margin of auto.
Regards!