Triggering Different Rendering Modes
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 standards 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 standards 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.
Read more about this topic: Quirks Mode
Famous quotes containing the words rendering and/or modes:
“But of all the views of this law [universal education] none is more important, none more legitimate, than that of rendering the people the safe, as they are the ultimate, guardians of their own liberty.”
—Thomas Jefferson (17431826)
“Heaven is large, and affords space for all modes of love and fortitude. Why should we be busybodies and superserviceable?”
—Ralph Waldo Emerson (18031882)