Q. Which method should I use to center my page?
The drawback of the
margin: auto; method is that it will not work in IE5. IE5 does (incorrectly) center blocklevel content when text-align: center; is used. So, for IE5, the following code can be used:
Code:
#centred {
text-align: center; /* IE5 Hack */
}
#centred #inner {
text-align: left; /* Un IE5 Hack */
margin: auto;
width: xxx; /* enter width here */
}
The drawback with the
negative margin method is that if the browser window is too narrow for the content, then part of the content will dissapear out of the left hand side of the window, without a scroll bar. The user can then not see that part of the content. Oops.
Later,
Douglas
PS: The complete source for CSS informations:
http://css-discuss.incutio.com/?page=FrontPage
If it isn't there, it probably doesn't exist.