L'element HTML <section>
representa una secció genèrica d'un document, és a dir, una agrupació temàtica de continguts, normalment amb un capçalera. Cada <section>
ha d'estar identificada, mitjançant la inclusió d'una capçalera (element <h1>
-<h6>
) com un fill de l'element <section>
.
Notes d'ùs :
- Si té sentit assenyalar per separat el contingut d'un element
<section>
, utilitzeu en el seu llocun element<article>
. - No utilitzeu l'element
<section>
com un contenidor genèric; per a això està<div>
, sobretot quan el seccionament és només per a fins d'estil. Una regla d'or és que un section hauria d'aparèixer lògicament en l'esquema d'un document.
Categories de contingut | Contingut dinàmic, contingut secció, contingut palpable. |
---|---|
Contingut permès | Contingut dinàmic. |
Omissió de l'etiqueta | Cap, tant l'etiqueta inicial com l’etiqueta final són obligatòries |
Elements pares permesos | Qualsevol element que accepti Contingut dinàmic. Tingueu en compte que un element <section> no ha de ser un descendent d'un element <address> . |
Interfície DOM | HTMLElement |
Atributs
Aquest element només inclou els atributs global.
Exemple 1
Abans
<div> <h1>Heading</h1> <p>Bunch of awesome content</p> </div>
Després
<section>
<h1>Heading</h1>
<p>Bunch of awesome content</p>
</section>
Exemple 2
Abans
<div>
<h2>Heading</h2>
<img src="bird.jpg" alt="bird">
</div>
Després
<section>
<h2>Heading</h2>
<img src="bird.jpg" alt="bird">
</section>
Especificacions
Especificació | Estat | Comentari |
---|---|---|
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 |
Navegadors compatibles
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!
Característica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Suport bàsic | 5 | 4.0 (2.0) | 9.0 | 11.10 | 4.1 |
Característica | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Suport bàsic | 2.2 | 4.0 (2.0) | 9.0 | 11.0 | 5.0 (iOS 4.2) |