A Document Type Declaration, or DOCTYPE, is an instruction that associates a particular SGML or XML document (for example, a webpage) with a Document Type Definition (DTD) (for example, the formal definition of a particular version of HTML). In the serialized form of the document, it manifests as a short string of markup that conforms to a particular syntax.
The HTML layout engines in modern web browsers perform DOCTYPE "sniffing" or "switching", wherein the DOCTYPE in a document served as text/html
determines a layout mode, such as "quirks mode" or "standards mode". The text/html
serialization of HTML5, which is not SGML-based, uses the DOCTYPE only for mode selection. Since web browsers are implemented with special-purpose HTML parsers, rather than general-purpose DTD-based parsers, they don't use DTDs and will never access them even if a URL is provided. The DOCTYPE is retained in HTML5 as a "mostly useless, but required" header only to trigger "standards mode" in common browsers.
Famous quotes containing the words document, type and/or declaration:
“What is a diary as a rule? A document useful to the person who keeps it, dull to the contempory who reads it, invaluable to the student, centuries afterwards, who treasures it!”
—Ellen Terry (18481928)
“The real American type can never be a ballet dancer. The legs are too long, the body too supple and the spirit too free for this school of affected grace and toe walking.”
—Isadora Duncan (18781927)
“I foresee the time when the painter will paint that scene, no longer going to Rome for a subject; the poet will sing it; the historian record it; and, with the Landing of the Pilgrims and the Declaration of Independence, it will be the ornament of some future national gallery, when at least the present form of slavery shall be no more here. We shall then be at liberty to weep for Captain Brown. Then, and not till then, we will take our revenge.”
—Henry David Thoreau (18171862)