views:

95

answers:

2

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
as Raithlin says
mdja
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
+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