Quirks mode in IE 6 and IE 7

Running IE 7 in “quirks mode” is an option for those who have already got the rendering and control they want for all IE-versions in that old mode, but still prefer to run all other browsers in “standard compliant mode”. It is probably an option few will make use of, but it is documented for completeness.

According to the IE 7 development team (IE blog), IE 7 in quirks mode will act like IE 6 in quirks mode, for backwards compatibility reasons. We have not tested this rendering mode extensively.

How to trigger quirks mode

Some doctypes (Sivonen; Gutfeldt; Bergevin) or the inclusion of an <xml> declaration, trigger “quirks mode” or backwards compatible mode in IE 6. In that case, IE 6 acts like IE 5.5, and shares the same bugs, problems and behaviour as its elder brother.

In IE 7, an <xml> declaration no longer changes the rendering mode (Campbell). Authors who want to keep all versions of IE up to IE 7 in quirks mode (without affecting other browsers) cannot rely on this anymore. However, inserting a comment before the doctype (but after the <xml> declaration) will still trigger quirks mode in IE 7, as in the example below.

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- ... and keep IE7 in quirks mode -->
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Quirks mode in IE 7 can also be triggered when coding HTML 4.01 documents. Inserting a comment before the DTD will trigger this backwards compatible mode in both IE 6 and IE 7.

  1. <!-- quirks mode -->
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Check the rendering mode

It isn't always obvious which rendering mode a browser is in. In IE address line, type in:

  1. javascript:alert(document.compatMode)

A bookmarklet (Dorward) may help you determine which mode a document is in. Right-click on the following link in IE and bookmark it: QorS Mode.

References

Markus Mielke:
Call to action: The demise of CSS hacks and broken pages
Henri Sivonen:
Activating the Right Layout Mode Using the Doctype Declaration
Matthias Gutfeldt:
Doctypes and their respective layout mode
Holly Bergevin:
Rendering Mode and Doctype Switching
Alastair Campbell:
Internet Explorer 7 doctype behaviour
David Dorward:
Quirks or Standards Mode Bookmarklet

This quirks mode chapter is part of the article On having layout.

Created, and last updated:
Aug. 15, 2005
Jun. 3, 2006
Editors:
Holly Bergevin
Ingo Chao
Bruno Fassino
John Gallant
Georg Sørtun
Philippe Wittenbergh
Translations:
Brazilian Portuguese by Mauricio Samy Silva
Italian by Gabriele Romanato
Contact us:
spam.layout@satzansatz.de
Copyright notice:
This work is published under a Creative Commons license.