Centering a block horizontally

With 'minimal' markup


Internet Explorer 5+, Firefox, Opera, Safari


<body>

 <!--[if lt IE 6]><div id="crapper"><![endif]-->

  <h1>Heading</h1>
  <p>And some content</p>

 <!--[if lt IE 6]></div><![endif]-->

</body>

Good browsers can style the body element. IE5 (crap browser) needs a wrapper; crapper. Internet Explorer 6 in quirks mode needs this wrapper as well. Use <!--[if lte IE 6]> in that case.

Check the source for the CSS.


Home - More stuff