Home >Web Front-end >HTML Tutorial >The basic components of html5 document structure
Basic components of HTML5 document structure: Doctype: declares the document type and follows the HTML5 standard Head: contains metadata (title, character set, style sheet) Body: contains document content (text , images, videos) Semantic elements (titles, paragraphs, lists, tables, forms) Comments: Provide information about the document and are not displayed in the web page Script elements: Contain JavaScript code to enhance document functionality
The basic components of HTML5 document structure
HTML5 document structure consists of the following basic components:
1. Doctype
<code class="html"><!DOCTYPE html></code>
Declare the document type and tell the browser that the document conforms to the HTML5 standard.
2. Head
<code class="html"><head> <title>文档标题</title> <meta charset="UTF-8"> <link rel="stylesheet" href="stylesheet.css"> </head></code>
Contains metadata about the document, such as title, character set, and external style sheets.
3. Body
<code class="html"><body> <h1>欢迎来到我的网站</h1> <p>这是我的网站的内容。</p> </body></code>
Contains the actual content of the document, such as text, images, and videos.
4. Semantic elements
HTML5 introduces many semantic elements to clearly describe the document content:
5. The comment
<code class="html"><!-- 这是注释 --></code>
is not displayed on the web page and is used to provide information about the document.
6. Script element (script)
<code class="html"><script src="script.js"></script></code>
Contains JavaScript code used to enhance the functionality of the document.
The above is the detailed content of The basic components of html5 document structure. For more information, please follow other related articles on the PHP Chinese website!