L'element HTML <main>
representa el contingut principal de el <body>
d'un document o aplicació. L'àrea de contingut principal està constituïda per contingut directament relacionat amb el tema central d'un document o amb la funcionalitat central d'una aplicació. Aquest contingut ha de ser exclusiu del document, excloent qualsevol contingut que es repeteixi en un conjunt de documents com a barres laterals, enllaços de navegació, informació sobre drets d'autor, logotips de llocs i formularis de cerca (tret que la funció principal del document sigui un formulari de cerca).
Categories de contingut | Contingut dinàmic, contingut palpable. |
---|---|
Contingut permès | Contingut dinàmic. |
Omissió de l'etiqueta | Cap; tant les etiquetes d'inici i finalització són obligatoris. |
Elements pares permesos | Qualsevol element que accept Contingut dinàmic. |
Interfície DOM |
HTMLElement |
Atributs
Aquest element només inclou els atribust globals.
Exemple
<!-- other content -->
<main>
<h1>Apples</h1>
<p>The apple is the pomaceous fruit of the apple tree.</p>
<article>
<h2>Red Delicious</h2>
<p>These bright red apples are the most common found in many
supermarkets.</p>
<p>... </p>
<p>... </p>
</article>
<article>
<h2>Granny Smith</h2>
<p>These juicy, green apples make a great filling for
apple pies.</p>
<p>... </p>
<p>... </p>
</article>
</main>
<!-- other content -->
Especificacions
Especificació | Estat | Comentari |
---|---|---|
HTML Living Standard The definition of '<main>' in that specification. |
Living Standard | S'ha eliminat la restricció sobre l'ús de <main> diverses vegades en un document, o com un descendent d'un element <article> . |
HTML 5.1 The definition of '<main>' in that specification. |
Recommendation | Sense canvis des de HTML5 |
HTML5 The definition of '<main>' in that specification. |
Recommendation | Definició inicial. |
Navegadors compatibles
L'element <main>
és àmpliament recolzat. Per a Internet Explorer 11 i posteriors, se suggereix que s'afegeixi una funció ària de "main" a l'element <main>
per garantir la seva accessibilitat (els lectors de pantalla com JAWS, usats en combinació amb versions anteriors d'Internet Explorer, podran comprendre el significat semàntic de l'element <main>
una vegada que aquest atribut role
estigui inclòs).
<main role="main">
...
</main>
Característica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Suport bàsic | Chrome 26 | 21.0 (21.0) | 12 | Opera 16 | Safari 7 |
Característica | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Suport bàsic | 4.4 | 21.0 (21.0) | No support | No support | 7.1 |