Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

In HTML, what is the use of the declaration?

2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "what is the use of statements in HTML", the content is simple and clear, and I hope it can help you solve your doubts. Let me lead you to study and study this article "what is the use of statements in HTML?"

Example

Document title

The contents of the document.

Label definition and instructions for use

The declaration is at the front of the document, before the tag.

The declaration is not a HTML tag; it is used to tell Web browsers which version of HTML the page uses.

In HTML 4.01, the declaration refers to DTD (document type declaration) because HTML 4.01 is based on SGML (Standard Generalized Markup Language Standard Universal markup language). DTD specifies the rules of the markup language to ensure that browsers render content correctly.

HTML5 is not based on SGML, so a reference to DTD is not required.

Tip: always add a declaration to your HTML document to make sure that the browser knows the document type in advance.

Differences between HTML 4.01 and HTML5

HTML 4.01 specifies three different declarations: Strict, Transitional, and Frameset. Only one is specified in HTML5:

HTML elements and Doctypes

See the HTML element and the legal Doctype to see which Doctype each HTML element appears in.

Tips and comments

Note: the tag does not end the tag.

Tip: the declaration is case-insensitive.

Tip: use W3C validation to check that you have written a legitimate HTML / XHTML document with the correct DTD!

Common DOCTYPE statements

HTML 5

HTML 4.01 Strict

This DTD contains all HTML elements and attributes, but does not include imagery or outdated elements (such as font). Framesets are not allowed.

HTML 4.01 Transitional

This DTD contains all HTML elements and attributes, including representational or outdated elements (such as font). Framesets are not allowed.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report