Because html5 is not based on SGML (Standard General Markup Language), there is no need to reference the DTD, but doctype is needed to standardize the behavior of the browser, that is, to run in the normal way, so html5 only needs to write Just doctype. "!DOCTYPE" is a document type declaration in the Standard Universal Markup Language that tells the browser the version of markup used to write the page.
The operating environment of this tutorial: Windows 10 system, HTML5 version, Dell G3 computer.
And HTML4.01 is based on SGML, so a reference to the DTD is needed to tell the browser the document type used by the document.
!DOCTYPE does not belong to the HTML (an application under the Standard Universal Markup Language) tag. It is a document type declaration of the Standard Universal Markup Language. In HTML, it tells the browser the version of the markup used to write the page.
Thedeclaration must be on the first line in the HTML5 document, before thetag. This tag tells the browser the HTML specification used by the document.
It is very important to specify !DOCTYPE in all HTML documents so that the browser understands the expected document type.
Three differentstatements are specified in HTML4.01, namely: Strict, Transitional and Frameset; but only one is specified in HTML5.Examples are as follows:
HTML5 document with the correct document type (!DOCTYPE):
文档的题目 文档的内容
Recommended tutorial: "
html video tutorialThe above is the detailed content of Why does html5 only need to write doctype?. For more information, please follow other related articles on the PHP Chinese website!