Home > Article > Web Front-end > Why does html5 only need to write doctype?
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.
The1a309583e26acea4f04ca31122d8c535 declaration must be on the first line in the HTML5 document, before the 100db36a723c770d327fc0aef2ce13b1 tag. 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 different 1a309583e26acea4f04ca31122d8c535 statements 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):
<!DOCTYPE HTML> <html> <head> <title>文档的题目</title> </head> <body>文档的内容</body> </html>
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!