Summary: Some modern browsers have two rendering modes. Quirk mode renders an HTML document like older browsers used to do it, e.g. Netscape 4, Internet Explorer 4 and 5. Standard mode renders a page according to W3C recommendations. Depending on the document type declaration present in the HTML document, the browser will switch into either quirk mode or standard mode. If there is no document type declaration present, the browser will switch into quirk mode.
Opera 7 now also features a Doctype switch. See the Opera
documentation for details. Opera chooses layout mode the same way as IE6.
Opera 7.02 even has the same <?xml ...?> bug: <?xml version="1.0"
encoding="UTF-8"?>
, will cause the browser to use quirk mode.
For the sake of completeness: For some months now, Mozilla has had a new "almost standard" mode. See Mozilla's DOCTYPE sniffing for details.
And as you may or may not know, Internet Explorer has always had (and still
has in version 6) a very regrettable bug: If there is anything before the DOCTYPE
declaration, it will switch to quirk mode. This means that the usual XML declaration,
e.g. <?xml version="1.0" encoding="UTF-8"?>
, will cause the
browser to use quirk mode.
Combine 1 and 2, and you end up with two scenarios:
Ignoring this situation would have been the simplest solution. But browser vendors were aware that both authors and visitors will blame the browser if the old pages, which used to look fine in the old browser, all of a sudden don't look right in the new browser. Therefore, compliance with W3C recommendations became a problem.
Therefore, both Microsoft and Mozilla decided to do something about it. The solution was two different rendering modes: The first mode, known as quirk or compatible mode, renders the pages like the old, incompatible browsers used to. The second mode, known as standard or compliant mode, renders them like the pages should be rendered according to W3C recommendations. The technical details about these modes can be found in the browser documentation mentioned below.
The big question now is: How does the browser decide which rendering mode he will use for a particular page? This question could be answered in a number of ways, of course. Both Microsft and Mozilla decided to use the document type declaration (or the lack thereof): If the document type declaration is of type a, then switch into standard mode. If the document type definition is of type b, or if no document type definition is found, then switch into quirk mode.
That's how it stands today. For further information use the links listed below: W3C Doctypes, Browser documentation, Articles and opinions, Standard support. For a tabular summary of all browsers that do doctype switching and, most important, when they switch into which mode, see the doctype switch table, a work in progress.
The W3C doctypes | |
---|---|
Document Type Declaration | W3C HTML4 Recommendation: The document type declaration names the document type definition (DTD) in use for the document |
TR/REC-html32 | The HTML3.2 Final Doctype |
TR/html4/ | The HTML4 Doctypes |
TR/xhtml1 | The XHTML1 Doctypes |
The browser documentation | |
Mozilla's Quirks Mode | David Baron: Comprehensive documentation of Doctype sniffing and quirks mode in Mozilla |
microsoft.com workshop | Doctype switching in IEX6 |
mozilla.org htmlparser source | Source code: Doctype switching in Mozilla |
quirk.css | Mozilla quirk css: Stylesheet for "quirk" mode |
hsivonen | Henri Sivonen: Things to Take into Account When Moving to Standards-Compliant HTML and CSS Authoring |
Mozilla quirk list | David Baron: Changes between Mozilla's standards mode and quirks mode |
Articles and opinions on doctype switching | |
'Standards' vs 'Quirks' | Serving XHTML 1.0: The W3C's short explanation of standards vs quirks mode |
oreillynet.com article | Eric Meyer about doctype switching in IEX5 / Mac |
hut.fi/~hsivonen | Henri Sivonen about doctype switching in Mozilla and IE5/Mac |
David Baron | David Baron on Mozilla Doctype Sniffing; according to him, this document is outdated. But it's a good discussion of the concept, and has links to more current documents |
developer.netscape.com | Known issues with support of web standards in Mozilla and Netscape. Because many developers first perceived doctype switching as a bug, this feature is also discusssed here. |
webmonkey | Jeffrey Veen about IEX6 Preview |
apple.com | Working with HTML - Doctype switching explained |
mozilla.layout | Arjun Ray: Sniffing Doctype Declarations is Bogus |
Mozilla | |
---|---|
mozilla.org faq | Gecko on standards |
bugzilla.mozilla.org | Known CSS2- bugs for the Gecko engine |
html.css | Mozilla html css: Stylesheet for HTML |
forms.css | Mozilla forms.css: Stylesheet for forms |
Netscape | |
developer.netscape.com | Netscape about CSS in Netscape; not necessarily entirely unbiased |
ekrockhome | Eric Krock from Netscape discusses standards support. |
Opera | |
opera.com specs | CSS in Opera 5 |
Internet Explorer | |
microsoft.com css reference | CSS Attributes Reference for IEX5 and IEX5.5, including MS-proprietary extensions |
microsoft.com workshop | CSS in IEX6 Public Preview; includes doctype switch explanations |
microsoft.com workshop | Microsoft Web Workshop on CSS for IEX |