Home Web Front-end HTML Tutorial Have you ever carefully understood the tag, how it is defined and how to use it_HTML/Xhtml_webpage production

Have you ever carefully understood the tag, how it is defined and how to use it_HTML/Xhtml_webpage production

May 16, 2016 pm 04:40 PM
Label

Foreword:
Today I was asked, "Have you carefully understood the tag?" I was stunned for a moment, because I first saw the suggestion to use XHTML Transitional DTD on W3cschool, and then I was very confused. Obediently set Dreamweaver's HTML document type to XHTML 1.0 Transitional by default. It has been used as a matter of course ever since. It’s true that people become lazier as they grow older, and many things are subconsciously taken for granted. Since I have been asked, I went to look for information, summarized it, and took it as a note~~ The definition of

: The
statement is located in the document The frontmost position in , before the tag. This tag tells the browser which HTML or XHTML specification the document uses.
This tag can declare three DTD types, representing strict version, transitional version and framework-based HTML version respectively. (If the markup in the document does not follow the DTD specified by the doctype declaration, the document may not pass code verification and may not be displayed correctly in the browser.)

Usage of :
Parsing: In the above declaration, it is declared that the root element of the document is html, which is defined in the public identifier as "-//W3C//DTD XHTML 1.0 Strict// EN" is defined in the DTD. The browser will understand how to find a DTD that matches this public identifier. If it is not found, the browser will use the URL following the public identifier as the location to look for the DTD.
-: Indicates that the organization name is not registered. The Internet Engineering Task Force (IETF) and the World Wide Web Consortium (W3C) are not registered ISO organizations.
is the default, indicating that the organization name has been registered.
DTD: Specifies the public text class, that is, the type of object being referenced. Default is DTD.
HTML: Specify a public text description, a unique, descriptive name for the public text being referenced. A version number can be attached at the back. Default is HTML.
URL: Specifies the location of the referenced object.
Strict: Excludes all representative attributes and elements that W3C experts want to phase out.

Three HTML document types:
HTML 4.01 specifies three document types: Strict, Transitional and Frameset.
a) If you need clean markup without cluttering the presentation layer, use the HTML Strict DTD type:

b) Transitional DTD can contain presentation attributes and elements that the W3C expects to be moved into style sheets . If the user is using a browser that does not support Cascading Style Sheets (CSS) and you have to use the rendering features of HTML, use the Transitional DTD type:

c ) Frameset DTD is used with A framed document. The Frameset DTD is identical to the Transitional DTD, except that the frameset element replaces the body element:


Three XML document types:
XHTML 1.0 specifies three XML document types: Strict, Transitional, and Frameset.
a) If you need clean markup without presentation clutter, use the XHTML Strict DTD type:

b) Transitional DTD can contain presentation attributes and elements that the W3C expects to be moved into stylesheets . If the user is using a browser that does not support Cascading Style Sheets (CSS) and you have to use the rendering features of HTML, use the Transitional DTD type:

c ) Frameset DTD is used with A framed document. The Frameset DTD is equivalent to the Transitional DTD, except that the frameset element replaces the body element:


Select the correct doctype:
To get the correct doctype declaration, The key is to make the dtd correspond to the standard that the document follows.
For example, assuming that the document follows the xhtml 1.0 strict standard, the document's doctype declaration should reference the corresponding dtd.
On the other hand, if the doctype declaration specifies an xhtml dtd, but the document contains old-style html markup, it is inappropriate; similarly, if the doctype declaration specifies an html dtd, but the document contains xhtml The 1.0 strict tag is also inappropriate.
If no valid doctype declaration is specified, most browsers will use a built-in default dtd. In this case, the browser will use the built-in dtd to try to display the tag you specify (but this is what happens when the page is poorly written).
I looked at JD.com, Taobao, and Blog Park, and they all use this one (I have always used this one):

But I found that Baidu and Google use "", so I checked the information carefully and found that HTML5 also uses this directly, but because HTML 5 is not based on SGML, there is no need to modify the DTD Make
references, but require a doctype to regulate browser behavior (to make browsers behave the way they should).

It is recommended to use "" directly in the future. Using will turn on the standard compatibility mode of the browser. In the standard compatibility mode, it is not guaranteed to be compatible with other versions (before IE6, directly Ignore it), Internet Explorer remains compatible, the rendering behavior of documents may be different from future Internet Explorer, but please feel free to use it~~

Tips:
XHTML 1 is the XML version of HTML 4.01, which is a format that is not forward-compatible.
The doctype in HTML 4.01 requires a reference to the DTD because HTML 4.01 is based on SGML.
SGML specifies a standard format for embedding description tags in documents and specifies a standard method for describing the structure of a document. The HTML format currently used on the WEB is a SGML document that uses a fixed set of tags.
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to search for text across all tabs in Chrome and Edge How to search for text across all tabs in Chrome and Edge Feb 19, 2024 am 11:30 AM

This tutorial shows you how to find specific text or phrases on all open tabs in Chrome or Edge on Windows. Is there a way to do a text search on all open tabs in Chrome? Yes, you can use a free external web extension in Chrome to perform text searches on all open tabs without having to switch tabs manually. Some extensions like TabSearch and Ctrl-FPlus can help you achieve this easily. How to search text across all tabs in Google Chrome? Ctrl-FPlus is a free extension that makes it easy for users to search for a specific word, phrase or text across all tabs of their browser window. This expansion

What is the clock behind the TikTok label? How to tag Douyin account? What is the clock behind the TikTok label? How to tag Douyin account? Mar 24, 2024 pm 03:46 PM

When browsing Douyin works, we often see a clock icon behind the tag. So, what exactly is this clock? This article will focus on the discussion of "What is the clock behind the Douyin label", hoping to provide some useful reference for your use of Douyin. 1. What is the clock behind the Douyin label? Douyin will launch some hot topic challenges. When users participate, they will see a clock icon after the tag, which means that the work is participating in the topic challenge and displays the remaining time of the challenge. For some time-sensitive content, such as holidays, special events, etc., Douyin will attach a clock icon after the label to remind users of the validity period of the content. 3. Popular tags: When a tag becomes popular, Douyin will add a clock icon after the tag to indicate that the tag is

How to add tags on Douyin to attract traffic? Which tags on the platform are easiest to attract traffic to? How to add tags on Douyin to attract traffic? Which tags on the platform are easiest to attract traffic to? Mar 22, 2024 am 10:28 AM

As a popular short video social platform, Douyin has a huge user base. For Douyin creators, using tags to attract traffic is an effective way to increase the exposure of content and attract attention. So, how does Douyin use tags to attract traffic? This article will answer this question in detail for you and introduce related techniques. 1. How to add tags on Douyin to attract traffic? When posting a video, make sure to choose tags that are relevant to the content. These tags should cover the topic and keywords of your video to make it easier for users to find your video through tags. Leveraging popular hashtags is an effective way to increase your video’s exposure. Research current popular tags and trends and incorporate them into your video descriptions and tags. These popular tags usually have higher visibility and can attract the attention of more viewers. 3. Label

A closer look at the video element in HTML A closer look at the video element in HTML Feb 24, 2024 pm 08:18 PM

Detailed explanation of the video tag in HTML The video tag in HTML5 is a tag used to play videos on web pages. It can render videos using different formats, such as MP4, WebM, Ogg, and more. In this article, we will introduce the use of video tag in detail and provide specific code examples. Basic Structure The following is the basic structure of the video tag:

What is the difference between html5 tag head and header? What is the difference between html5 tag head and header? Jan 17, 2022 am 11:10 AM

Differences: 1. The head tag is used to define the head of the document, which is a container for all head elements, and the header tag is used to define the header (introduction information) of the document; 2. All browsers support the head tag, and older versions of browsers None of the browsers support the header tag, and browsers such as IE9+ and above are required to support the header tag.

How to delete external contact tags on DingTalk app How to delete external contact tags on DingTalk app Feb 24, 2024 am 08:20 AM

How to delete external contact tags on DingTalk app? DingTalk has a function to delete external contact tags, but most friends don’t know how to delete external contact tags on DingTalk. Next is the DingTalk guide that the editor brings to users. Graphical tutorial on how to delete external contact tags in the Ding app. Interested users can come and take a look! How to delete external contact tags in DingTalk app 1. First open DingTalk APP and click the [Management] function as shown below on the main page; 2. Then enter the enterprise management interface and find [External Contacts]; 3. Then on the external contact setting function page, select the [Label Management] service; 4. Then on the main contact label page, select the type of label group you want to delete; 5. Finally, click on the red label group

How to implement a layout with a fixed navigation menu using HTML and CSS How to implement a layout with a fixed navigation menu using HTML and CSS Oct 26, 2023 am 11:02 AM

How to use HTML and CSS to implement a layout with a fixed navigation menu. In modern web design, fixed navigation menus are one of the common layouts. It can keep the navigation menu always at the top or side of the page, allowing users to browse web content conveniently. This article will introduce how to use HTML and CSS to implement a layout with a fixed navigation menu, and provide specific code examples. First, you need to create an HTML structure to present the content of the web page and the navigation menu. Here is a simple example

How to implement a labeled input box using Vue? How to implement a labeled input box using Vue? Jun 25, 2023 am 11:54 AM

With the development of web applications, labeled input boxes are becoming more and more popular. This kind of input box allows users to input data more conveniently, and also facilitates users to manage and search the entered data. Vue is a very powerful JavaScript framework that can help us quickly implement labeled input boxes. This article will introduce how to use Vue to implement a labeled input box. Step 1: Create a Vue instance First, we need to create a Vue instance on the page, the code is as follows: &l

See all articles