Why does html5 only need to write doctype?

WBOY
Release: 2022-06-07 17:15:13
Original
3007 people have browsed it

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.

Why does html5 only need to write doctype?

The operating environment of this tutorial: Windows 10 system, HTML5 version, Dell G3 computer.

Why do you only need to write doctype in html5? The browser runs as they should)

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):

   文档的题目 
 文档的内容 
Copy after login

Recommended tutorial: "

html video tutorial

The 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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!