Getting Margin:Auto; To Work in Internet Explorer

Blog Stuff, Windows Add comments

I’ve been doing a bit of web design in my spare time lately and before long I came across the issue of using margin: auto; in my stylesheet not working in internet explorer. Meeehhhh! I couldn’t be doing with that and given that the best way to attack an unknown problem is to search for knowledge I hit google (not literally of course).

Turns out, that you can force Internet Explorer (and other browsers) to parse your cascading style sheets strictly by using a strict doctype definition. I used the one below for my project;

<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>

This was news to me, but welcome, because now I can center my divs in a cross-browser compatible way and move on to other problems like why background images for input elements aren’t loading on https pages (please let me know if you know why).

Oh and if you’re interested in more information http://hsivonen.iki.fi/doctype/ has a useful table of which doctype definitions trigger what behaviour in the popular browsers.

One Response to “Getting Margin:Auto; To Work in Internet Explorer”

  1. Getting Margin:Auto; To Work in Internet Explorer Says:

    [...] Go to the author’s original blog: Getting Margin:Auto; To Work in Internet Explorer [...]

Leave a Reply

WP Theme & Icons by N.Design Studio | Akismet has gobbled 358 spam comments...Mmmm Tasty :-)
Entries RSS Comments RSS Log in