HTML <! DOCTYPE> declaration
Examples
try it"
Browser Support
All major browsers support <! DOCTYPE> declaration.
Tag definitions and instructions
<! DOCTYPE> declaration in the document in the foremost position, before the <html> tag in.
<! DOCTYPE> declaration is not an HTML tag; it is used to tell the Web browser page which uses the HTML version.
In HTML 4.01, <! DOCTYPE> declaration required reference DTD (document type declaration), since HTML 4.01 is based on SGML (Standard Generalized Markup Language Standard Generalized Markup Language). DTD specifies the rules for markup language to ensure that the browser can properly render content.
HTML5 is not based on SGML, and therefore does not require a reference DTD.
Tip: Always give your HTML document to add a statement to ensure that the browser can know the document type <DOCTYPE!>.
Differences between HTML 4.01 and HTML5
HTML 4.01 specifies three different statements, namely <DOCTYPE!>: Strict, Transitional, and Frameset. HTML5 specifies only one of:
HTML elements and Doctypes
See HTML elements and legitimate Doctype , look at each HTML element which appears in the Doctype.
Tips and Notes
NOTE: <! DOCTYPE> tag has no end tag.
Tip: <! DOCTYPE> declaration is not case-sensitive.
Tip: Use verify the W3C check if you write HTML with a legitimate right of the DTD / XHTML document!
Common DOCTYPE declaration
HTML 5
HTML 4.01 Strict
This DTD contains all HTML elements and attributes, but does not include representation or obsolete elements (such as font). Frame set is not allowed.
HTML 4.01 Transitional
This DTD contains all HTML elements and attributes, including appearance or obsolete elements (such as font). Frame set is not allowed.
HTML 4.01 Frameset
The DTD HTML 4.01 Transitional and the same, but allows the use of frameset content.
XHTML 1.0 Strict
This DTD contains all HTML elements and attributes, but does not include representation or obsolete elements (such as font). Frame set is not allowed. Structure must be written according to the XML standard format.
XHTML 1.0 Transitional
This DTD contains all HTML elements and attributes, including appearance or obsolete elements (such as font). Frame set is not allowed. Structure must be written according to the XML standard format.
XHTML 1.0 Frameset
The DTD XHTML 1.0 Transitional and the same, but allows the use of frameset content.
XHTML 1.1
The DTD XHTML with the same 1.0 Strict, but allows you to add a module (for example to provide ruby support for East Asian languages).