The basic components of html5 document structure

下次还敢
Release: 2024-04-22 11:00:26
Original
993 people have browsed it

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

The basic components of HTML5 document structure

HTML5 document structure consists of the following basic components:

1. Doctype

<code class="html"><!DOCTYPE html></code>
Copy after login

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>
Copy after login

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>
Copy after login

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:

  • Title element (h1-h6): used to represent different title levels.
  • Paragraph element (p): used to represent text paragraphs.
  • List elements (ul, ol): Used to create unordered lists or ordered lists.
  • Table element (table): used to create tables.
  • Form elements (input, form): used to create forms.

5. The comment

<code class="html"><!-- 这是注释 --></code>
Copy after login

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>
Copy after login

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!

Related labels:
css
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!