{{HTMLRef}}
L'element HTML <figure>
representa un contingut autònom, sovint amb una llegenda ({{HTMLElement("figcaption")}}), i normalment es fa referència com una sola unitat. Si bé es relaciona amb el flux principal, la seva posició és independent del corrent principal. Normalment això és una imatge, una il·lustració, un diagrama, un fragment de codi o un esquema que es fa referència en el text principal, però que es poden moure a una altra pàgina o un apèndix sense afectar el flux principal.
<figure>
s'exclou de l'esquema principal del document.<figure>
introduint dins d'aquest un {{HTMLElement("figcaption")}} (com el primer o l'últim fill).Categories de contingut | Contingut dinàmic, seccionament arrel, contigut palpable. |
---|---|
Permitted content | Un element {{HTMLElement("figcaption")}}, seguit per contingut dinàmic; or contingut dinàmic seguit per un element {{HTMLElement("figcaption")}}; o contingut dinàmic. |
Tag omission | {{no_tag_omission}} |
Permitted parent elements | Qualsevol element que accepti contingut dinàmic. |
DOM interface | {{domxref("HTMLElement")}} |
Aquest element només inclou els atributs globals.
<!-- Just a figure --> <figure> <img src="https://developer.mozilla.org/static/img/favicon144.png" alt="An awesome picture"> </figure> <p></p> <!-- Figure with figcaption --> <figure> <img src="https://developer.mozilla.org/static/img/favicon144.png" alt="An awesome picture"> <figcaption>Fig1. MDN Logo</figcaption> </figure> <p></p>
<figure> <figcaption>Get browser details using navigator</figcaption> <pre> function NavigatorExample() { var txt; txt = "Browser CodeName: " + navigator.appCodeName; txt+= "Browser Name: " + navigator.appName; txt+= "Browser Version: " + navigator.appVersion ; txt+= "Cookies Enabled: " + navigator.cookieEnabled; txt+= "Platform: " + navigator.platform; txt+= "User-agent header: " + navigator.userAgent; } </pre> </figure>
function NavigatorExample() { var txt; txt = "Browser CodeName: " + navigator.appCodeName; txt+= "Browser Name: " + navigator.appName; txt+= "Browser Version: " + navigator.appVersion ; txt+= "Cookies Enabled: " + navigator.cookieEnabled; txt+= "Platform: " + navigator.platform; txt+= "User-agent header: " + navigator.userAgent; }
<figure> <figcaption><cite>Edsger Dijkstra :-</cite></figcaption> <p>"If debugging is the process of removing software bugs, <br /> then programming must be the process of putting them in"</p> </figure>
"Si la depuració és el procés d'eliminació d'errors del programari, la programació ha de ser el procés de posada en"
L'element <figure>
es podria utilitzar per al marcatge d'un poema.
<figure> <p> Depression is running through my head,<br> These thoughts make me think of death,<br> A darkness which blanks my mind,<br> A walk through the graveyard, what can I find?.... </p> <figcaption><cite>Depression</cite>. By: Darren Harris</figcaption> </figure>
Especificació | Estat | Comentari |
---|---|---|
{{SpecName('HTML WHATWG', 'semantics.html#the-figure-element', '<figure>')}} | {{Spec2('HTML WHATWG')}} | |
{{SpecName('HTML5 W3C', 'grouping-content.html#the-figure-element', '<figure>')}} | {{Spec2('HTML5 W3C')}} |
{{CompatibilityTable}}
Característica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Suport bàsic | 8 | {{CompatGeckoDesktop("2.0")}} | 9.0 | 11.10 | 5.1 |
Característica | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Suport bàsic | 3.0 | {{CompatGeckoMobile("2.0")}} | 9.0 | 11.0 | 5.1 (iOS 5.0) |