figure
Summary
The figure element (<figure>) represents self-contained content (such as an image), optionally with a caption, that can be referenced as a single unit from the main content of the document.
Overview Table
A figure can be given a caption with the figcaption element.
Examples
This example shows the figure element to mark up a code listing. The figcaption element represents the caption of the figure. The author has also provided a link to the figure in the main content by using a named anchor.
<!-- Main Content -->
<p>In <a href="#l4">listing 4</a> we see the primary core interface API declaration.</p>
<!-- Figure Content -->
<figure id="l4">
<figcaption>Listing 4. The primary core interface API declaration.</figcaption>
<pre><code>interface PrimaryCore {
boolean verifyDataLine();
void sendData(in sequence<byte> data);
void initSelfDestruct();
}</code></pre>
</figure>
Notes
Remarks
The figure element can be used to annotate content that can be referenced from the main content of the document, such as illustrations, diagrams, photos, code listings, and so on. Figures can be moved away from primary content without affecting the flow of the document. You can jump to the figure from the main content by using a named anchor. The id attribute of the figure element specifies the fragment identifier (name of the anchor). The default CSS for the figure element is as follows.
margin: 1em 40px
The figure element, like aside, separates content from the main flow. Use the aside element when the content is simply related, but not essential. Use figure if the content is essential, but position is not important. Windows Internet Explorer 9. The figure element is only supported for webpages displayed in IE9 Standards mode. For more information, see Defining Document Compatibility.
Related specifications
See also
Other articles
Attributions
Microsoft Developer Network: [Windows Internet Explorer API reference Article]