HTML елемент <section>
являє собою узагальнену секцію документу, яка допомагає категоризувати контент, зазвичай, заголовком. Кожний елемент <section>
повинен бути ідентифікований, зазвичай, використанням заголовків (<h1>
-<h6>
element) в якості дочірнього елементу <section>
.
Зауваження щодо використання :
- Якщо є доцільним розбивати на категорії контент у елементі
<section>
, то використовуйте замість нього елемент<article>
. - Не використовуйте елемент
<section>
як загальний контейнер; цю функцію виконує елемент<div>
, особливо тоді, коли секціонування призначено для стилізації. Емпіричне правило використання цього елементу полягає у тому, що розділ повинен логічно відображатись у контурі документу
Content categories | Flow content, Sectioning content, palpable content. |
---|---|
Permitted content | Flow content. |
Tag omission | None, both the starting and ending tag are mandatory. |
Permitted parent elements | Any element that accepts flow content. Note that a <section> element must not be a descendant of an <address> element. |
DOM interface | HTMLElement |
Атрибути
Цей елемент може включати в себе лише глобальні атрибути.
Приклад 1
До
<div> <h1>Heading</h1> <p>Bunch of awesome content</p> </div>
Після
<section>
<h1>Heading</h1>
<p>Bunch of awesome content</p>
</section>
Приклад 2
До
<div>
<h2>Heading</h2>
<img src="bird.jpg" alt="bird">
</div>
Після
<section>
<h2>Heading</h2>
<img src="bird.jpg" alt="bird">
</section>
Специфікації
Specification | Status | Comments |
---|---|---|
HTML Living Standard The definition of '<section>' in that specification. |
Living Standard | |
HTML 5.1 The definition of '<section>' in that specification. |
Recommendation | |
HTML5 The definition of '<section>' in that specification. |
Recommendation |
Підтримка веб-переглядачами
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 5 | 4.0 (2.0) | 9.0 | 11.10 | 4.1 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | 2.2 | 4.0 (2.0) | 9.0 | 11.0 | 5.0 (iOS 4.2) |