I would like to display all my content in a div that is 800px wide, centred in the page. That way, all browser window widths are catered for. How do I go about doing that?
+5
A:
Set your div CSS as follows:
#container {
width: 800px;
margin: 0 auto;
}
Raithlin
2009-05-20 11:59:20
as Raithlin says
mdja
2009-05-20 12:18:56
You will also need to set text-align:center; on your body tag otherwise it won't work for old versions of IE
Matthew James Taylor
2009-05-21 00:33:22
+4
A:
I would also recommend adding text-align:left;
to the container div and adding text-align:center;
to the body tag. Reason being that Internet Explorer 6.0 will not handle the auto margins.
body {
text-align:center;}
#container {
margin: 0px auto;
text-align:left;
width: 800px;}
Reece
2009-05-20 15:42:09