Doctypes, IE, and Quirks Mode

Web Dev 14 July 2011 | 2 Comments

In testing a site, I found some interesting quirky behaviors with IE. The CSS was syntatically correct and it confounded me why the visual flubs were smattering my site. Upon closer examination, I found that the site had no doctype.

Just a note, dear reader, that I came into this project after it was already written and was trying to eliminate some bugs as I was finding them.

So, there was no doctype. Interestingly, IE will throw the document into Quirks mode if no doctype is found. Did you know that? I sure didn’t.

What is Quirks mode?

Quirks mode refers to a technique used by some web browsers for the sake of maintaining backward compatibility with web pages designed for older browsers, instead of strictly complying with W3C and IETF standards in standards mode.

To sum up, it will make all versions of IE start to behave like IE5.5. Yikes, right? That’s what I thought. That’s actually the intended behavior, though. Just in case they had problems, developers could omit the doctype and thus have their tried & true version of IE. thoroughly explains it and tells us the rationale behind these decisions. It’s also called “DOCTYPE switching”.

Apparently all of this was already developed by the time I started learning web development, and so this was all new to me. Perhaps this will help you on a headachy night if you have to work on some code that relies on Quirks mode!

All references I found useful in learning about this matter:

Be Sociable, Share!

Tagged in ,

2 Responses on “Doctypes, IE, and Quirks Mode”

  1. Tony White says:

    I’ve been struggling with this myself recently. Provided some html (complete with doctype) to a development team, who had to turn around and convert this to xml based markup which did not allow a doctype. I had to come up with new ways to center content and re-engineer box model issues.

  2. Jennifer says:

    Wow what a challenge! Fortunately for me I just added the doctype and tweaked as I went. Phew I had it easy!

Leave a Reply