Document Type Declaration

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:

    ... research is never completed ... Around the corner lurks another possibility of interview, another book to read, a courthouse to explore, a document to verify.
    Catherine Drinker Bowen (1897–1973)

    Lise: Look, monsieur, I don’t know what type of girl you think I am, but I’m not. And now I would like to return to my friends.
    Jerry: I thought you were bored with them. You sure looked it.
    Lise: You should see me now.
    Jerry: Ouch.
    Alan Jay Lerner (1918–1986)

    [The Declaration of Independence] meant to set up a standard maxim for free society, which should be familiar to all, and revered by all; constantly looked to, constantly labored for, and even though never perfectly attained, constantly approximated, and thereby constantly spreading and deepening its influence, and augmenting the happiness and value of life to all people of all colors everywhere.
    Abraham Lincoln (1809–1865)