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:
“Ambitious men spend their youth in rendering themselves worthy of patronage; it is their great mistake. While the foolish creatures are laying in stores of knowledge and energy, so that they shall not sink under the weight of responsible posts that recede from them, schemers come and go who are wealthy in words and destitute of ideas, astonish the ignorant, and creep into the confidence of those who have a little knowledge.”
—HonorĂ© De Balzac (17991850)
“The essence of belief is the establishment of a habit; and different beliefs are distinguished by the different modes of action to which they give rise.”
—Charles Sanders Peirce (18391914)