Need help with css margin

I am trying to put content_wrapper div in the center of the browser. It works for Chorme, Firefox, Opera, safari but it does not work for IE 8. Here is my css

body { font-size: 12px; font-family: Arial, Helvetica, sans-serif }
#content_wrapper { width: 1000px; margin: 0 auto; border: 1px solid #000000 }

Help Please


Have you got a full modern doctype on your page otherwise IE will go into quirks mode and won’t center in the normal way?

There’s nothing wrong with that code, so something else on the page is throwing it out. Could you post your whole page? Do you have a doctype declaration at the top of the page?

EDIT: oops, got shot at high noon. :slight_smile:

With the crowd on checking for a doctype – but… stupid question…

Is #content_wrapper a div or other block-level container?

Some observations – you should NEVER set px as the font size on body since you just shtupped accessibility, if you set the font-size you shouldn’t trust the default line-height so get that in there, at which point you might as well use the condensed font property. 1000px is also NOT 1024 friendly as you should be taking 32 to 48px off of that (I use 48 to be on the safe size) – so you’re working on something that’s not even 1024 friendly cross-browser…

… and condensing your css to single lines and including all those spaces make it hard to tell what’s attributes and values.

ANYTHING we tell you though just from that CSS is wild guesses – CSS without the markup it’s applied to is gibberish; and a snippet cannot possibly tell us the whole story as it could be any number of other things in your document interfering with this.