Most often, browsers determine which rendering mode to use based on the presence of a
Document Type Declaration in the page; if a full DOCTYPE is present the browser will use no-quirks mode, and if it is absent the browser will use quirks mode. For example, a web page which began with the following DOCTYPE would trigger no-quirks mode: The following DOCTYPE is syntactically invalid, containing the public identifier keyword "PUBLIC" but no public identifier (indicating the name of the version of HTML in use), and no system identifier
URL of an HTML
Document Type Definition. This would trigger quirks mode: Additionally, a web page which does not include a DOCTYPE at all will render in quirks mode. One notable exception to this is
Microsoft's
Internet Explorer 6 browser, which will render a page in quirks mode if the DOCTYPE is preceded by an
XML prolog, regardless of whether a full DOCTYPE is specified. Thus an
XHTML page which begins with the following code would be rendered in quirks mode by IE 6: The above is useful to an extent as it can be used to trigger quirks mode
only in IE 6. Quirks mode in any version of IE will also be triggered if anything precedes the DOCTYPE. For example, if a hypertext document contains a comment, space or any tag before the DOCTYPE declaration, IE will use quirks mode: The problem with the XML declaration was fixed in version 7 of Internet Explorer, in which the XML prolog is simply ignored. However, for maximum compatibility with existing and older web browsers, the
World Wide Web Consortium, which maintains the XHTML specification, suggests that authors of XHTML documents could consider omitting the XML declaration.
Comparison of document types Henri Sivonen compiled a list of various document types and how they are treated in the most common browsers, showing whether pages are rendered in
Quirks,
Standards, or
Almost standards mode. The criterion used for "Almost standards mode" is non-standard table cell height rendering. This table applies to content served with the
Content-Type text/html. Content served with the Content-Type application/xhtml+xml is rendered in Standards mode in Chrome, Firefox, Internet Explorer 9, Safari, and Opera. Internet Explorer 6, 7, and 8 do not support Content-Type application/xhtml+xml. Additionally, in
Mozilla Firefox and
Opera the rendering mode in use for a given page is indicated on the 'Page info' informational box. ==References==