Codectionary / Developer documentation / HTML

<figure>, <figcaption>

The <figure> element wraps self-contained content — typically an image, illustration, diagram, code snippet, or chart — along with an optional caption provided by <figcaption>. Content in a figure is meant to be referenceable independently of the main flow; a reader should be able to move it elsewhere on the page (or even to an appendix) without breaking the document's meaning.

Syntax

<figure>
  <img src="chart.png" alt="Sales chart">
  <figcaption>Figure 1: Quarterly sales</figcaption>
</figure>

Examples

Image with Caption

The most common use of figure: an image with a descriptive caption.

<figure>
  <img src="https://via.placeholder.com/500x300" alt="Mountain landscape at sunset">
  <figcaption>A sunset over the mountains, taken in 2025.</figcaption>
</figure>

Code Snippet as a Figure

Using figure to present a labeled code example.

<figure>
  <pre><code>const sum = (a, b) => a + b;</code></pre>
  <figcaption>Example: an arrow function that adds two numbers</figcaption>
</figure>

Multiple Images in One Figure

Grouping several related images under a single caption.

<figure>
  <img src="before.png" alt="Before redesign">
  <img src="after.png" alt="After redesign">
  <figcaption>Before and after the homepage redesign</figcaption>
</figure>

Best practices

  • Use figure when content (and its caption) should make sense even if moved elsewhere on the page
  • figcaption can appear as either the first or last child of figure — both are valid
  • Not every image needs a figure — use it when a caption or independent referencing genuinely adds value
  • The alt attribute on img still matters even inside a figure; figcaption is a caption, not alt text

Browser compatibility

Support applies to the named feature, not every attribute or behaviour in this article. Versions refer to browsers, not operating systems.

<figure>

Desktop

Chrome
Supported
From 8
Firefox
Supported
From 4
Safari
Supported
From 5.1
Edge
Supported
From 12
Opera
Supported
From 11

Mobile

Safari on iOS
Supported
From 5
Chrome for Android
Supported
From 18
Firefox for Android
Supported
From 4
Samsung Internet
Supported
From 1.0

MDN BCD record for this feature · MDN reference

Support history and limitations

Chrome

  • From 8

Firefox

  • From 4

Safari

  • From 5.1

Edge

  • From 12

Opera

  • From 11

Safari on iOS

  • From 5

Chrome for Android

  • From 18

Firefox for Android

  • From 4

Samsung Internet

  • From 1.0
<figcaption>

Desktop

Chrome
Supported
From 8
Firefox
Supported
From 4
Safari
Supported
From 5.1
Edge
Supported
From 12
Opera
Supported
From 11

Mobile

Safari on iOS
Supported
From 5
Chrome for Android
Supported
From 18
Firefox for Android
Supported
From 4
Samsung Internet
Supported
From 1.0

MDN BCD record for this feature · MDN reference

Support history and limitations

Chrome

  • From 8

Firefox

  • From 4

Safari

  • From 5.1

Edge

  • From 12

Opera

  • From 11

Safari on iOS

  • From 5

Chrome for Android

  • From 18

Firefox for Android

  • From 4

Samsung Internet

  • From 1.0

MDN BCD 8.1.5 · Dataset built 2026-10-08 · Mapping reviewed 2026-10-21. These dates are not individual browser-test or claim-verification dates. Unknown means the data does not establish support.

HTML Living Standard

Specifications & further reading