IE 6/7/8 ignores margin 0 auto

Hi - phew, finally got 2/3rds of my new css site up, but now have to upload final one-third with old <table>'s body - and just slap new css header + menu (btmnav) above + below the <table>'s.

Problem is IE 6/7/8 will not recognize margin: 0 auto. See:

You’ll see all IE’s are failing to center these 3:

  • #wrapper
  • .ebk-sm
  • .f4w-txt

Problem doesn’t occur in any other browser.

Any ideas what I can do?

thank you! - Val

A good starting point would be to remove the comment from the top of the document so that the DOCTYPE comes first. Anything present before the DOCTYPE will throw IE into Quirks Mode (see Centering).

Then, take a deep breath and brave the validator. Automatic validation is choking on a non UTF-8 character in the markup so you’ll need to paste your source into the “Validate by direct input” field.

379 errors are reported. Some are due to XHTML style /> tag termination being used with an HTML 4.01 Transitional DOCTYPE. Some indicate missing alt attributes on img elements, which will not affect your intended rendering of the page, but there are many other markup errors. As you are in the process of modernizing your site there’s probably no need to draw your attention to the vagaries of font tags and other presentational markup.

Hi -

>remove the comment from the top of the document

thanks, works perfectly now!

I don’t validate any more because my site is such a mix-up of old + new :slight_smile:

best, Val