DOCTYPE is shorthand for document type, which is simply used to tell the browser what document criteria to use to parse the document.
Notice: It must be placed at the top of the document, all code and logo IQ
First, the DOCTYPE statement indicates what rule sets the browser should use to interpret the markup in the document. The rules are the rules that are contained in a document type definition (DTD) published by the Consortium. Each DTD contains a series of tags, attributes, properties, which are used to mark the contents of a Web document, and also include rules that specify which tags can appear in which other tags. If the markup in the document does not conform to the DTD specified by the DOCTYPE declaration, this document may not be displayed correctly in the browser, except in the case of code validation.
If the document follows any criteria, then the DOCTYPE of the document should refer to the corresponding DTD.
- Choose what kind of doctype
There are 3 types of DTD (document type definition) declarations in XHTML 1.0 that can be selected: transitional (Transitional), Strict (Strict), and Frame (Frameset).
There are also 3 DTD (document type definition) declarations in HTML4.01 that can be selected: Transition (transitional), Strict (Strict), and Frame (Frameset).
The HTML 5 declaration is simple <! DOCTYPE Html> Now the mainstream browser is using this declaration, because HTML 5 is not based on SGML (standard Universal Markup Language), so you don't need to reference the DTD, but you need to DOCTYPE to regulate the browser's behavior (let the browser run the way they should)而HTML4.01基于SGML,所以需要对DTD进行引用,才能告知浏览器文档所使用的文档类型。
1. Transition of
A less stringent DTD that allows the use of HTML4.01 's identity in the page (conforming to the XHTML syntax standard). The syntax for the transition DTD is as follows:
"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
2. of strict
A strict DTD that does not allow the use of the identity and attributes of any presentation layer, such as. The syntax for a strict DTD is as follows:
"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
3. Framework of
A DTD used specifically for frame pages, which is used when the page contains frame elements. The syntax for a framework's DTD is as follows:
"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd" >
- Explain why HTML5 is not based on SGML:
SGML is a very powerful but complex markup language, and HTML and XML derive from it. But today, when it comes to setting HTML5 standards, the group wants to get rid of some of the useless features and statements of SGML and continue the HTML4 style rather than the strict XHTML style. So HTML5 is not based on SGML.
In fact, this is a legacy of history, HTML experienced html1.0--html2.0--html3.2--html4.0--html4.01, but later the xhtml--xhtml1.1--xhtml2.0 (? ), XHTML (Extensible Hypertext Markup Language), which is an XML-based superscript language, is syntactically rigorous and machine-oriented. Because of the web designer's disregard for the needs of the designers, met with unanimous opposition. Therefore, the Web Hypertext Application Working Group WHATWG on the HTML5 of the draft, in the face of this situation, in 2008, so that XHTML2.0 merged with it into a HTML5 official version. HTML5 from this.
DOCTYPE and the difference between XHTML and HTML