Document type declaration

[1] In the serialized form of the document, it manifests as a short string of markup that conforms to a particular syntax.

The DOCTYPE is retained in HTML5 as a "mostly useless, but required" header only to trigger "standards mode" in common browsers.

Since the syntax for the external identifier and internal subset are both optional,[3]: 403–404  the document type name is the only information which it is mandatory to give in a DOCTYPE declaration.

The DOCTYPE declaration can optionally contain an external identifier, following the root element name (and separating syntax such as spaces), but before any internal subset.

Although the interpretation of system identifiers in general SGML is entirely system-dependent (and might be a filename, database key, offset, or something else),[3]: 378  XML requires that they be URIs.

This association might e.g. be performed by means of a catalog file resolving the FPI to a system identifier.

[3]: 378 The last, optional, part of a DOCTYPE declaration is surrounded by literal square brackets ([]), and called an internal subset.

[7] It is possible, but uncommon, to include the entire DTD in-line in the document, within the internal subset, rather than referencing it from an external file.

The HTML tag is not part of the doctype declaration but has been included in the examples for orientation purposes.

[8] Both W3C HTML5 and its corresponding WHATWG version recommend browsers to only accept XHTML DTDs of certain FPIs and to prefer using internal logic over fetching external DTD files.

[9]: §13.2 Strict DTD does not allow presentational markup with the argument that Cascading Style Sheets should be used for that instead.