L'elemento HTML <figure> rappresenta un contenuto indipendente che può avere una descrizione tramite l'elemento ({{HTMLElement("figcaption")}}). L'immagine, la descrizione e il suo contenuto hanno riferimenti indipendenti.
| Categorie di contenuti | Contenuti di flusso, sezioni e struttura |
|---|---|
| Contenuti permessi | L'elemento {{HTMLElement("figcaption")}}, seguito da contenuti di flusso; o contenuti di flusso seguiti dall'elemento {{HTMLElement("figcaption")}}; o contenuti di flusso. |
| Omissione del tag | {{no_tag_omission}} |
| Genitori permessi |
Qualsiasi elemento che accetti Contenuti di flusso. |
| Ruoli ARIA permessi | {{ARIARole("group")}}, {{ARIARole("presentation")}} |
| Interfaccia DOM | {{domxref("HTMLElement")}} |
Questo elemento include gli attributi globali.
<figure> è un'immagine, un'illustrazione, un diagramma, un frammento di codice, etc., relativo al flusso principale di un documento, ma che può essere posizionato in un'altra parte del documento o all'appendice senza impatti sul flusso principale.<figure> inserendo l'elemento {{HTMLElement("figcaption")}} al suo interno (sia come primo che come ultimo figlio). Il primo elemento <figcaption> trovato sarà utilizzato come descrizione.<!-- Solo un'immagine --> <figure> <img src="https://developer.mozilla.org/static/img/favicon144.png" alt="Il bellissimo logo MDN."> </figure> <!-- Un'immagine con descrizione --> <figure> <img src="https://developer.mozilla.org/static/img/favicon144.png" alt="Il bellissimo logo MDN."> <figcaption>MDN Logo</figcaption> </figure>
<figure>
<figcaption>Ottieni dettagli sul browser utilizzando <code>navigator</code>.</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 + "; ";
console.log("NavigatorExample", txt);
}
</pre>
</figure>
<figure> <figcaption><cite>Edsger Dijkstra:</cite></figcaption> <blockquote>If debugging is the process of removing software bugs, then programming must be the process of putting them in.</blockquote> </figure>
<figure>
<p style="white-space:pre">
Bid me discourse, I will enchant thine ear,
Or like a fairy trip upon the green,
Or, like a nymph, with long dishevell'd hair,
Dance on the sands, and yet no footing seen:
Love is a spirit all compact of fire,
Not gross to sink, but light, and will aspire.</p>
<figcaption><cite>Venus and Adonis</cite>,
by William Shakespeare</figcaption>
</figure>
| Specification | Status | Comment |
|---|---|---|
| {{SpecName('HTML WHATWG', 'semantics.html#the-figure-element', '<figure>')}} | {{Spec2('HTML WHATWG')}} | |
| {{SpecName('HTML5.2', 'grouping-content.html#the-figure-element', '<figure>')}} | {{Spec2('HTML5.2')}} | Nessun cambiamento da HTML 5.0. |
| {{SpecName('HTML5 W3C', 'grouping-content.html#the-figure-element', '<figure>')}} | {{Spec2('HTML5 W3C')}} |
{{Compat("html.elements.figure")}}