This site is designed for accessibility. Content is obtainable and functional to any browser or Internet device. This site's full visual experience is available in a graphical browser that supports web standards. Please consider upgrading your web browser.
Term | Meaning |
---|---|
DOCTYPE |
DOCTYPE is a means of specifng what syntax the page
uses, no more, no less. It should appear at the very beginning of an HTML document in order to identify the content of the document as conforming (theoretically) to a particular HTML DTD specification. It's the component of an SGML document (of which an HTML document is supposed to be an instance in this case) that contains the formal definition of the markup grammar (valid element type names, which elements contain which, valid attribute names, etc.) An SGML parser has to process these definitions before it can check the instance markup. A shorthand form of the _document type declaration_ is where some or all of these formal definitions are gathered together in a separate file and incorporated much like a '#include' preprocessor statement would work in C. An _external identifier_ like "-//W3C//DTD HTML 4.01 Transitional" is a location- and context-independent name for such a file. (You'll here a whole bunch of mythology to the effect that this name is about the HTML spec itself, or about how HTML semantics are announced, but all of that is bogus.) |
DOCTYPE switching |
Switching is the mechanism by which browsers examine the DOCTYPE (or lack thereof) contained in a document, and picks a rendering mode to match it. Typically, older or malformed DOCTYPEs cause browsers to enter "quirks" mode, which emulates historical authoring practices built around the flaws found in older browsers. Newer DOCTYPEs will trigger "strict" mode, where they attempt to hew as closely as possible to the W3C recommendations in order to deliver a more consistent cross-browser experience. This lets authors decide which mode to use, a decision which is generally fueled by their target audience. Note: the browser doesn't actually use the DOCTYPE to validate the content -- it only uses this string to toggle specific behavior of the renderer. |
DOCTYPES examples THAT WORK |
HTML 4.01 Strict, Transitional, Frameset
XHTML 1.0 Strict, Transitional, Frameset
XHTML 1.1 DTD
|
Quirks mode |
Using an incomplete or outdated DOCTYPEor no DOCTYPE at allthrows browsers into Quirks mode, where the browser assumes youve written old-fashioned, invalid markup and code per the depressing industry norms of the late 1990s. In this setting, the browser will attempt to parse your page in backwardcompatible fashion, rendering your CSS as it might have looked in IE4, and reverting to a proprietary, browserspecific DOM. |
standards/strict mode | A recent DOCTYPE that includes a full URI (a complete web address) tells these browsers to render your page in standardscompliant mode, treating your (X)HTML, CSS, and DOM as you expect them to be treated. |