Document Type Statements and (X)HTML Versions
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. (X)HTML documents should begin with a declaration. This statement identifies the type of mark-up that is supposedly used in a document. For example,indicates that we are using the transitional variation of HTML 4.01 that starts with a root element html. In other words, an tag will serve as the ultimate parent of all the content and elements within this document.
A declaration might get a bit more specific and specify the URI (Uniform Resource Identifier) of the DTD being used as shown here:
"http://www.w3.org/TR/html4/loose.dtd">
In the case of an XHTML document, the situation really isn’t much different:
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
However, do note that the root html element here is lowercase, which hints at the case sensitivity found in XHTML.
HTML or XHTML Version |
!DOCTYPE Declaration |
HTML5 |
|
HTML 4.01 Strict |
"http://www.w3.org/TR/html4/strict.dtd"> |
HTML 4.01 Frameset |
"http://www.w3.org/TR/html4/frameset.dtd"> |
HTML 4.01 Transitional |
"http://www.w3.org/TR/html4/loose.dtd"> |
HTML 4.0 Strict |
"http://www.w3.org/TR/html4/strict.dtd"> |
HTML 4.0 Frameset |
"http://www.w3.org/TR/html4/frameset.dtd"> |
HTML 4.0 Transitional |
"http://www.w3.org/TR/html4/loose.dtd"> |
HTML 3.2 |
|
HTML 2.0 |
|
XHTML Basic 1.1 |
"http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd"> |
XHTML Basic 1.0 |
"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> |
XHTML 2.0 |
"http://www.w3.org/MarkUp/DTD/xhtml2.dtd"> |
XHTML 1.1 |
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
XHTML 1.0 Frameset |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> |
XHTML 1.0 Strict |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
XHTML 1.0 Transitional |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
While there are many different versions of (X)HTML, the good news is that the rough document structure defined for each is pretty similar; of course, the bad news is that little details will be different from version to version, so you need to be precise with your syntax.
