HTML <figure> Tag

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 3 Examples
Media & Figures

What You’ll Learn

By the end of this tutorial, you’ll group images, videos, and diagrams in semantic, accessible figure elements.

The HTML <figure> tag encapsulates self-contained media content, such as images and videos, optionally with a <figcaption> caption. This guide covers syntax, attributes, accessibility, and best practices for beginners and web developers alike.

01

Core Syntax

Wrap media in <figure> with optional figcaption.

02

Image Groups

Pair photos with descriptive captions.

03

Video Blocks

Embed videos as labeled media units.

04

Semantic HTML

Mark self-contained content for SEO and a11y.

05

CSS Styling

Style borders, spacing, and caption layout.

06

figure vs div

Know when semantic grouping beats a generic box.

What Is the <figure> Tag?

The figure element (<figure>) is a semantic HTML5 container for self-contained content—typically an image, illustration, diagram, video, or code snippet—that is referenced from the main document flow. It can include an optional <figcaption> element for a visible caption or legend.

💡
figcaption is optional

A figure does not require a caption. Add figcaption when a visible label helps readers understand the media.

Figures are ideal for content that could be moved to an appendix without breaking the narrative. They improve structure, accessibility, and how search engines interpret your page.

📝 Syntax

Wrap your media inside opening and closing <figure> tags. Add <figcaption> when you need a caption:

syntax.html
<figure>
  <img src="your-image.jpg" alt="Description of the image">
  <figcaption>Your Caption Here</figcaption>
</figure>

Syntax Rules

  • Place one primary piece of content (image, video, diagram, code) inside figure.
  • figcaption is optional but should be used when a caption adds value.
  • figcaption must be a direct child of figure.
  • Always include meaningful alt text on images inside a figure.

⚡ Quick Reference

PatternCode SnippetNotes
Image figure<figure><img><figcaption>Most common pattern
Video figure<figure><video><figcaption>Self-contained media block
No caption<figure><img></figure>Valid without figcaption
Styled figureclass="media-figure"CSS hook on figure
Caption element<figcaption>Optional child of figure
Default styleBlock containerMinimal browser defaults

⚖️ <figure> vs <div>

Both can wrap media visually, but only figure carries semantic meaning:

Feature<figure><div>
Semantic roleSelf-contained media/contentGeneric container
Caption support<figcaption>Use paragraph or span manually
SEO & a11yBuilt-in figure semanticsRequires extra markup or ARIA
Best forImages, charts, videos, code blocksLayout and non-semantic grouping

⚖️ <figure> and <figcaption>

These elements work together as a labeled media unit:

ElementRoleWhen to use
<figure>Group containerWrap images, videos, diagrams, code snippets
<figcaption>Caption or legendDescribe what the figure shows (optional)
TogetherLabeled figureArticles, tutorials, galleries, documentation
figure aloneValid patternCaption not always required

🧰 Attributes

The <figure> tag has no tag-specific attributes. Use global attributes on the figure, and put media-specific attributes on child elements like img or video:

class Global

CSS hook for borders, spacing, and layout of the figure block.

class="media-figure"
id Global

Unique identifier for linking or scripting the figure.

id="chart-1"
lang Global

Language of caption or content when it differs from the page.

lang="fr"
style Global

Inline styling for one-off figure presentation (prefer CSS classes).

style="border: 1px solid #ccc;"
attributes.html
<figure class="media-figure">
  <img src="your-image.jpg" alt="Description of the image" class="custom-image">
  <figcaption class="custom-caption">Your Caption Here</figcaption>
</figure>

Attributes like src and alt belong on img, not on figure itself.

Examples Gallery

Styled figures, image captions, and embedded video patterns with copy-ready code and live previews.

Live Preview

A figure grouping an image placeholder and caption:

This is an example image

Image with Caption

The most common use case for <figure> is combining an image with a descriptive figcaption.

image-with-caption.html
<figure>
  <img src="example.jpg" alt="An example image">
  <figcaption>This is an example image</figcaption>
</figure>
Try It Yourself

📚 Common Use Cases

Use <figure> for blog post photos, product gallery images, chart and diagram blocks, tutorial screenshots, embedded videos, code listing excerpts, and pull-quote illustrations that stand apart from the main text.

Embedded Video

Wrap videos in figure to provide a self-contained media block with an optional caption:

embedded-video.html
<figure>
  <video controls>
    <source src="your-video.mp4" type="video/mp4">
  </video>
  <figcaption>Your Video Caption</figcaption>
</figure>
Try It Yourself

Styled Figure with CSS Classes

Apply class attributes to the figure, image, and figcaption for consistent design system styling.

styled-figure.html
<figure class="media-figure">
  <img src="your-image.jpg" alt="Description of the image" class="custom-image">
  <figcaption class="custom-caption">Your Caption Here</figcaption>
</figure>
Try It Yourself

Styling <figure> with CSS

Figures have minimal browser defaults. Style the container and caption for polished media blocks:

max-width Constrain image width
border Card-style figures
figcaption Caption typography
margin Spacing from text
figure-styles.css
/* Figure container styling */
figure.media-figure {
  max-width: 420px;
  margin: 1.5rem 0;
  padding: 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
}

figure img {
  display: block;
  width: 100%;
  border-radius: 8px;
}

figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #64748b;
  text-align: center;
}

Live styled figure

♿ Accessibility

Semantic figures help all users understand media in context:

  • Always use alt on imagesfigcaption does not replace the alt attribute.
  • Add figcaption when helpful — visible captions benefit sighted users and add context.
  • Keep figures self-contained — the content should make sense on its own.
  • Avoid nesting figures — one figure per media unit keeps structure clear.

🧠 How <figure> Works

1

Author wraps self-contained content

Place an image, video, or diagram inside figure.

Markup
2

Optional caption is added

Include figcaption when a visible label helps readers.

Semantics
3

Browser exposes figure semantics

Assistive tech and search engines recognize a labeled media unit.

Accessibility
=

Structured, meaningful media

Readers and search engines understand images and videos in context.

Universal Browser Support

The <figure> element is fully supported in all modern browsers and Internet Explorer 9+.

Baseline · HTML5 Semantic

Semantic figures that work everywhere

From legacy Internet Explorer to the latest mobile browsers — figure is a safe HTML5 building block for labeled media.

100% Core tag support
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 9+ · Legacy environments
Full support
Opera All modern versions
Full support
<figure> tag 100% supported

Bottom line: Ship semantic media groups with confidence. The <figure> element is safe to use in every production environment today.

Conclusion

Harnessing the power of the <figure> tag allows you to create well-structured and accessible media content on your web pages. Incorporate this element into your HTML markup to provide a richer and more meaningful experience for your audience.

Pair figure with optional figcaption, keep alt text on images, and use CSS classes for consistent styling across articles, galleries, and documentation.

💡 Best Practices

✅ Do

  • Always include alt text on images inside figure
  • Use figcaption for descriptive, relevant captions
  • Style figures with CSS for consistent presentation
  • Keep each figure focused on one self-contained unit of content

❌ Don’t

  • Replace alt with figcaption alone
  • Use figure purely as a layout wrapper without semantic purpose
  • Nest multiple unrelated media items in one figure
  • Put figcaption outside the figure element

Key Takeaways

Knowledge Unlocked

Six truths every developer should know about <figure>

Bookmark these before you ship — they’ll keep your media blocks semantic and accessible.

6
Core concepts
🔖 02

Optional Caption

figcaption adds visible context when needed.

Structure
📝 03

Not a div

Semantic grouping beats generic containers.

Comparison
🎬 04

Images & Video

Works with photos, diagrams, and embedded media.

Use Case
🎨 05

CSS Friendly

Style borders, spacing, and captions freely.

Styling
🌐 06

Universal Support

HTML5 semantic element with full browser support.

Compatibility

❓ Frequently Asked Questions

It groups self-contained content such as images, diagrams, videos, or code listings, optionally with a figcaption caption.
No. figcaption is optional but recommended when a visible caption adds context for readers.
figure is semantic and marks self-contained media. div is a generic container with no built-in meaning.
No tag-specific attributes exist. Use global attributes on figure and media attributes on child elements like img.
Yes. figure is fully supported in all modern browsers and Internet Explorer 9 and later.

Structure Your Media

Group images and videos with figure and figcaption in the interactive HTML editor.

Try image with caption →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful