Home  >  Article  >  Web Front-end  >  Illustration of HTML document structure

Illustration of HTML document structure

零到壹度
零到壹度Original
2018-03-29 15:08:522337browse

This article mainly shares with you an illustration of the document structure of HTML. It has a good reference value and I hope it will be helpful to everyone. Let’s follow the editor to have a look.

The structure of the HTML document can be understood as the grammatical structure of the web page, an encoding format. This document structure can make the writing of web pages very standardized. Standardized code can increase code readability and make it look more professional.

HTML documents always start with the tag and end with . In other words, all the content of the web page is contained between and . The currently known HTML document structure is as follows:

<html>......</html>

All HTML files have two main structures: head and body. Usually the description information of the document is placed in the head, and the subject information of the document (the information displayed on the browser) is placed in the body part. The first update of the HTML document structure is:

<html>
    <head>
        ......    </head>
    <body>
        ......    </body></html>

The title is the most important information in the head of the HTML document. Each document should have a title, which allows visitors to know what the main content of the webpage is when they see the title of the webpage. So where does the title appear on the web page? Take Baidu's homepage as an example:
Illustration of HTML document structure
As you can see from the picture above, the title of Baidu's homepage is "Baidu, you are the way"
The document title is placed Between and at the head of the document. Its structure is as follows:

<head>
    <title>文档标题</title></head>

The main part of the HTML document contains the text, images, hyperlinks, etc. that are displayed on the web page. In the main part of the document, you mainly write what you want to give to the user. View, or what the user wants to see. The body section begins with the tag and ends with . Its structure is as follows:

<body>
    文档主要内容:文本、图像、音频、视频、超链接等。</body>

Use to describe the document type to help the browser display the web page correctly There are many types of documents in the web world, and the browser can only clarify The type of document can display the document more accurately. Therefore, we should add to each document to describe the document type. precedes the tag.
In HTML4.01, the document type declaration is as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

In HTML5, the document type declaration is very simple:

<!DOCTYPE html>

When programming, it is often necessary to add comments to keep your logic clear and increase the readability of the code. The method of adding comments in HTML documents is:

<!--注释内容-->

When the browser reads the HTML document, it automatically ignores the content of the comments. In other words, the content of the annotation will not be displayed on the browser.

Finally, the complete structure of the online HTML document:

<!DOCTYPE html>
    
        文档标题
        ......    
    
        文档主要内容:文本、图像、音频、视频、超链接等。    

Related recommendations:

HTML5 document structure Analysis

HTML5: Organization document structure

HTML document structure

The above is the detailed content of Illustration of HTML document structure. For more information, please follow other related articles on the PHP Chinese website!

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