Home  >  Article  >  Web Front-end  >  What does the html5 section tag mean? Summary of usage of html5 section tag

What does the html5 section tag mean? Summary of usage of html5 section tag

寻∝梦
寻∝梦Original
2018-08-29 16:36:3823391browse

This article mainly introduces the definition of the HTML5 section tag and its usage. Finally, there is a case summary. Now let us start reading this article.

Let’s explain it first The meaning of the html5 section tag:

html5 section tag defines the section (section, section) in the document. Such as chapters, headers, footers, or other parts of the document.

Look at an example to help you understand the section tag better:

The section in the document explains the PRC:

<section>
  <h1>PHP中文网</h1>
  <p>这里是PHP中文网,网址是www.php.cn</p>
</section>

The example effect is as follows:

What does the html5 section tag mean? Summary of usage of html5 section tag

Now let’s talk about the points to note about the section tag:

section is not a tag specifically used as a container. If it is just used For setting styles or script processing, the special div

section should have titles (h1~6), but it is recommended to use article instead

A simple rule is that only elements The section element is only suitable when the content will be listed in the document outline.

The function of section is to divide the content on the page into sections, such as each titled section, functional area or article section. Do not confuse it with article, which has its own complete and independent content.

html5 Usage of section tag:

html5 introduces the

tag, which is used to describe the structure of the document. It has the same meaning as the
tag . But in certain circumstances, there are obvious differences between the two.

w3’s definition of

is: defining a section of a document (can have its own
and
).

w3’s definition of

is: Define a section of a document. (But it seems more suitable for outer layout, lacking semantics.)

Now let’s look at a case:

<body>
  <header></header>
  <div id=“content”>
     <section></section>
     <section></section>
  </div>
  <footer></footer>
</body>

Here, we use

inside to
, because the difference between the two cannot be clearly distinguished here:
<section id=”content”>
   <section></section>
   <section></section>
</section>

Or:

<div id=”content”>
   <div></div>
   <div></div>
</div>

Summary of HTML5 section tag:

We use the

tag to lay out the entire outermost chapter, and use
to define Internal chapters. Of course, if the entire document is regarded as a chapter, you can also use
instead of
, but it is recommended not to use
to replace places that should be laid out with

The above is the detailed content of What does the html5 section tag mean? Summary of usage of html5 section tag. 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