Home > Article > Web Front-end > What are the necessary parts of a standard html document?
has 5 necessary parts: 1. DOCTYPE statement, used to tell the browser the version of the markup used to write the page; 2. HTML root element, which contains the metadata of the document and provides the browser with relevant document content. and tag information; 3. Head, which mainly includes encoding declarations, titles, style sheet embeddings, etc.; 4. Title part, used to define the title of the document; 5. Body content part, including all the content of the document.
The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.
HTML document is a description of a document. It has a fixed structure and is divided into many parts. Each part contains one or more elements. Some elements are used to describe the basic information of the document, and some describe the document structure. The following is the structure of a basic HTML document:,
<!DOCTYPE html> <html lang="en"> <head> <title>Your page title</title> </head> <body> ..... </body> </html>
This HTML document describes a blank page. These basic components determine the HTML document. outline and the browser's initial environment.
You can see the 5 necessary parts of a standard html document.
Declaration part: DOCTYPE statement
DOCTYPE is the abbreviation of document type.
The doctype declaration is not an HTML tag; rather, it is a document type tag, which is an instruction that tells the browser the version of markup in which the page was written.
The doctype declaration is a document type declaration in a standard universal markup language. It is used in web design to indicate what version of XHTML or HTML you are using.
This element tells the browser two things:
It processes HTML documents;
is used to mark documents The version of the content's HTML. The above writing method indicates that HTML5 is used.
It is very important to specify the doctype in all HTML documents so that the browser understands the expected document type.
Explanation:
tag has no closing tag.
is not case sensitive.
##Overall analysis: All content
The head element contains the metadata of the document, which is provided to the browser Provides information about the document's content and markup, and can also contain scripts and references to external resources (such as CSS style sheets).
The various attributes and information of the HTML document are defined in the
The
1. The title can be defined in the browser tab.
2. You can provide a title for the page when adding it to favorites.
3. The title of the page can be displayed in search engine results.
Example:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>php中文网</title> </head> <body> <p>正文的内容显示在浏览器窗口中。</p> <p>title元素的内容显示在浏览器标签,收藏夹和搜索引擎结果中。</p> </body> </html>
##Content:
## The document body contains the content that visitors can see.
After having this basic structure, we can gradually add other elements of HTML later, continuously enrich the document, and finally get the page we want.
Note:
In HTML 5, all special attributes of
have been removed. However, the tag supports standard attributes in HTML 5:Attribute | Value | Description |
---|---|---|
accesskey | character | Specifies the keyboard shortcut to access the element |
class | classname | Specifies the element The class name (used to specify the class in the style sheet). |
contenteditable |
|
Specifies whether users are allowed to edit content. |
contextmenu | menu_id | Specifies the context menu of the element. |
data-yourvalue | value |
Creator-defined properties. Authors of HTML documents can define their own attributes. Must start with "data-". |
| Specifies elements The text direction of the content. ||
| Specifies whether users are allowed to drag elements. ||
hidden | Specifies that this element is irrelevant. Hidden elements will not be displayed. | |
id | Specifies the unique ID of the element.||
| is used to combine elements. ||
| is used for combined projects. ||
language_code | Specifies the language code of the content in the element.||
| Specifies whether the element must be Do a spelling or grammar check. ||
style_definition | Specifies the inline style of the element.||
id | Specifies the item corresponding to the element.||
number | Specifies the tab key control order of elements.||
text | Specifies additional information about the element.
html video tutorial"
The above is the detailed content of What are the necessary parts of a standard html document?. For more information, please follow other related articles on the PHP Chinese website!