1. Definition
The DOCTYPE tag is a document type declaration of a standard generic markup Language that is intended to tell the standard generic markup Language parser what document type definition (DTD) should be used to parse the document.
<! The doctype> declaration must be the first line in the HTML document, before the
2. Role
Declares the parsing type of the document (Document.compatmode), avoiding the browser's bizarre pattern.
Document.compatmode:
Backcompat: Weird mode, the browser uses its own weird mode to parse the rendered page.
Css1compat: Standard mode, browser uses the standard resolution rendering page.
This property will be recognized and used by the browser, but if your page does not have a DOCTYPE declaration, then compatmode default is Backcompat, the browser in its own way to parse the rendered page, then the different browsers will show a different style.
If you add <! to your page DOCTYPE html> So, then it is equivalent to open the standard mode, then the browser will have to be honest in accordance with the standards to parse the rendering page , so that your page in all browsers display is a look.
This is <!. The role of DOCTYPE html>.
3. How to use
HTML 5:
<! DOCTYPE html>
HTML 4.01 Strict
The DTD contains all the HTML elements and attributes, but does not include the display and deprecated elements (such as font). Frameset (framesets) is not allowed.
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01//en" "HTTP://WWW.W3.ORG/TR/HTML4/STRICT.DTD" >
HTML 4.01 Transitional
The DTD contains all the HTML elements and attributes, including both display and deprecated elements (such as font). Frameset (framesets) is not allowed.
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" >
HTML 4.01 Frameset
The DTD is equivalent to the HTML 4.01 transitional, but allows the frameset content.
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 frameset//en" "HTTP://WWW.W3.ORG/TR/HTML4/FRAMESET.DTD" >
XHTML 1.0 Strict
The DTD contains all the HTML elements and attributes, but does not include the display and deprecated elements (such as font). Frameset (framesets) is not allowed. tags must be written in well-formed XML.
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
XHTML 1.0 Transitional
The DTD contains all the HTML elements and attributes, including both display and deprecated elements (such as font). Frameset (framesets) is not allowed. tags must be written in well-formed XML.
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
XHTML 1.0 Frameset
The DTD is equivalent to XHTML 1.0 transitional, but allows frameset content.
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 frameset//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd" >
XHTML 1.1
The DTD is equivalent to XHTML 1.0 Strict, but allows models to be added (for example, to provide Ruby support for East Asian languages).
<! DOCTYPE HTML PUBLIC "-//w3c//dtd XHTML 1.1//en" "Http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" >
About <! DOCTYPE html>