margin: 0 auto; not centering in Internet Explorer?

m

The other day, I had chopped up a design.  Sliced and diced if you will.  I proceeded to creating the HTML once all of the images were sliced up.

Things were going great.  As per usual I began designing in Mozilla to use Firebug to tweak the CSS and HTML.  Once I finished the design, I proceeded to test in Chrome, Safari, and of course, Internet Explorer.

Every browser but Internet Explorer was working perfectly, what gives?

The worse part is, I know I’ve had this problem before.  If you’re like me, you may have worked on 100s of different projects and they all start to blend together because you’ve done this here and that there.

Luckily, I was actually able to remember what the problem was!  I forgot my DOCTYPE at the top of my file:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”   “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

Add that bad boy to the top of your file, reload and voila, Internet Explorer now loads the web site like every other browser does!

This may not be the only issue that you see without a DOCTYPE and Internet Explorer.  Sometimes it may be a spacing issue, things wrapping incorrectly, etc…  The route of the cause will, most likely, be a missing DOCTYPE.

Cheers.

About the author

  • Kevin

    DUDE, THANK YOU! I was getting ready to go to war with my IE browser. I somehow missed updating the doctype from the default that is given when creating a new page in Edit Plus.

  • http://supertwinkie.co.cc Twinkie

    Thank you! I can never remeber those doc types by memory, so for simple documents I always used to leave them out. Needless to say, I had a lot of headaches with Internet explorer and other browsers. Thank you for the tip.

  • Kathy

    Thanks – that saved me some time 🙂

  • ConnorJack

    Thank you. I was searching my brain for some answer and it was as simple as that. You saved me from starting all over again.
    THANK YOU

  • Bruce

    Thx, man!

  • http://none Apology

    thanks bro it helps. after an hour fighting with my IE browser at last i manage to fixed it.

  • http://roberthammdesigns.com Robert

    God, I was wondering why my notepad website was giving me such a head ache.

    Thank you very much!

  • http://WWW.hyperio-art.com Ian

    Of course, leave it to IE to hold us to the most stringent of xhtml markup standards, and yet until version 9.0 they don’t even comply with css2.
    Thanks a lot for this advice, centering blocks id always the most anoying, and this just saved me quite a bit of time.

  • http://sendgifttoindian.com/ MHK

    Thanks for sharing this .
    This is very helpful to every designer

  • jnjn

    ahah thanks, how could i miss that.

  • Ram

    Cooooooooool Bro.
    Thanks

  • Alexander

    You very good man. My mind blow out with this problem. You save me, realy…

  • Bo Lane

    Dude, if I could kiss you I would. I was racking my brain and completely forgot about the DOCTYPE. Thanks for the reminder.

  • http://www.cheapsupra.cc supra shoes

    Hi, this is a tutorial as i like : easy to follow for an awesome result.
    I’m gonna use it for sure ! Go on.

  • http://www.khadijahgoestoschool.com Khadijah

    amazing! I was prepared to spend a couple of hours..turns out to be a couple of minutes!
    Thank you

  • http://www.khadijahgoestoschool.com Khadijah

    Amazing! I was prepared to spend a couple of hours…with this I spent a couple of minutes…!
    Thanks…

  • Shmitt

    Thanks a lot, it saved my site. Cheers and keep the good work !

  • http://infotechguru.net MrPeter1985

    I checked and my zbench already has that in the header, but I still have that issue.

    Could you take a peek at it?

    The rest of my site is fine except for the Blog.

    Everything is correct in FF and Chrome. TIA

    -Pete

  • YES!

    THANKYOU SO GOD DAM MUCH! I’m so glad i stumbled upon this

  • http://www.gucci-shoes-wholesale.com/ Mens Gucci shoes

    This is a very good start, to write such an article to share with you, should be very grateful to the author, put a lot of us. Able to voice our opinions. This is a good theme, analysis of the good people has strong feelings. For me, this article has influenced me greatly, very good. I really appreciate!

  • tony

    Oh, you are a life saver.. I’ve just wasted about 2 hours trying to figure that oug..

  • Pingback: http://cecy.com.au

  • Pingback: paladin pvp guide

  • Pingback: secrets 4 loss weight

  • Pingback: top rc zone

  • Pingback: online virus removal

  • Pingback: Goozle Zone

  • Pingback: Ania Antonette Quisumbing

  • Pingback: bad credit loans

  • Pingback: one buck resume

  • Pingback: ultimate power profits

  • Pingback: zig zaga

  • Pingback: Motorbike Accident Claim Solicitors

  • Pingback: Personal Injury Solicitors in Manchester

  • Pingback: wholesale promo items

  • Pingback: ZigZag

  • Pingback: ZCode System Review

  • Pingback: new york asian escorts

  • Pingback: Movie

  • Pingback: Info

  • Pingback: Web

  • Pingback: Climate

  • Pingback: Collecting

  • Pingback: Learn

  • Pingback: Blog

By Jamie

My Books