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)
“Mediocre people have an answer for everything and are astonished at nothing. They always want to have the air of knowing better than you what you are going to tell them; when, in their turn, they begin to speak, they repeat to you with the greatest confidence, as if dealing with their own property, the things that they have heard you say yourself at some other place.... A capable and superior look is the natural accompaniment of this type of character.”
—Eugène Delacroix (17981863)
“I enclose to you a copy of the declaration of independence as agreed to by the House, and also, as originally framed. You will judge whether it is the better or worse for the Critics.”
—Thomas Jefferson (17431826)