Doctype Switch

From CSS Discuss

Jump to: navigation, search

Since the web quickly commercialized, and fast rollout of proprietary features necessitated lax parsing and rendering of invalid markup, Tag Soup proliferated on the web.

With the move towards a more interoperable web, there was a need to find a way to render strictly-written documents according to standards, without breaking the rest of the (incorrect) code on the web. Thus was born the Rendering Mode .

The Doctype Switch is the hack that enables this change. HTML is an SGML application, and as such, ?some? SGML syntax is allowed (expected, even) in HTML documents. (This is not true for XHTML, since this is an XML application, and not SGML. (XML is a subset of SGML)) The DOCTYPE declaration, in SGML, provides a means of relating a document instance to a document type definition. It was almost always left out of early HTML files.

Leaving out the DOCTYPE declaration, or using certain other DOCTYPEs will result in Quirks Rendering Mode, while using a "modern" DOCTYPE, or using an unknown (perhaps new) DOCTYPE will trigger Strict Rendering Mode.

See also:

Personal tools