Opentopia Directory Encyclopedia Tools

Document Type Declaration

Encyclopedia : D : DO : DOC : Document Type Declaration


A Document Type Declaration, or DOCTYPE, associates a particular SGML or XML document with a Document Type Definition (DTD). In the serialized form of the document, it manifests as a short string of markup that conforms to a particular syntax.

Despite its name, a Document Type Declaration [is not suitable for deducing the type of the document], although apparently it was originally supposed to be.

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".

Example

A Document Type Declaration can be found in the source code of every Wikipedia page. For example, the first line of many Wikipedia pages reads as follows:

This Document Type Declaration includes by reference a DTD, whose public identifier is -//W3C//DTD XHTML 1.0 Transitional//EN and whose system identifier is http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd. An entity resolver may use either identifier for locating the referenced external entity. The root element is declared to be html.

You can also use a stricter version of HTML if you want. HTML 4.01 does not allow presentational markup with the argument that you should use Cascading Style Sheets for that instead. This is how the strict doctype looks:

See also

External links

 


From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.

Search Titles
0123456789
ABCDEFGHIJ
KLMNOPQRST
UVWXYZ?

E-mail this article to:

Personal Message: