/
Do you add images, charts, or code snippets to your web content? If so, you need to know about HTML5's <figure> and <figcaption> elements. These powerful semantic elements help you present visual content with proper context and accessibility.
Many developers simply use <img> tags with text paragraphs, missing out on better semantic structure and accessibility benefits. The figure and figcaption elements solve this problem by creating a clear relationship between visual content and its description. You'll learn how to use these elements effectively, improve your website's accessibility, and create better-structured content that both users and search engines will appreciate.
The <figure> element represents self-contained content that is typically referenced from the main content. It's like a container that groups related visual content together with its caption or description.
The <figcaption> element provides a caption or description for the content inside a <figure> element. It must be placed as either the first or last child of the figure element.
These elements work as a team to create semantic relationships between visual content and its explanatory text. The figure acts as the container, while figcaption provides the descriptive text.
The figure and figcaption elements create a clear semantic connection between visual content and its description, making it easier for browsers and assistive technologies to understand the relationship.
Screen readers can announce the caption when users encounter the figure, providing important context for visually impaired users.
Content within a figure element should be self-contained and could theoretically be moved to another location (like an appendix) without affecting the document's flow.
Figure elements can contain various types of content including images, illustrations, diagrams, code snippets, videos, and even multiple related items.
<figure>
<img src="diagram.jpg" alt="Website structure diagram">
<figcaption>Figure 1: Basic website structure showing header, navigation, main content, and footer</figcaption>
</figure>The figcaption can be placed at the beginning or end of the figure:
<!-- Caption at the beginning -->
<figure>
<figcaption>Monthly sales data for 2025</figcaption>
<img src="sales-chart.jpg" alt="Bar chart showing monthly sales">
</figure>
<!-- Caption at the end -->
<figure>
<img src="sales-chart.jpg" alt="Bar chart showing monthly sales">
<figcaption>Monthly sales data for 2025</figcaption>
</figure><figure>
<img src="sunset-beach.jpg" alt="Golden sunset over ocean waves">
<figcaption>A beautiful sunset at Malibu Beach, California</figcaption>
</figure><figure>
<img src="before-renovation.jpg" alt="Kitchen before renovation">
<img src="after-renovation.jpg" alt="Kitchen after renovation">
<figcaption>Before and after photos of our kitchen renovation project</figcaption>
</figure><figure>
<img src="web-development-process.png" alt="Flowchart showing web development steps">
<figcaption>
Figure 2: The web development process from planning to deployment
</figcaption>
</figure><figure>
<video controls width="400">
<source src="tutorial-video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<figcaption>Video tutorial: How to create your first HTML page</figcaption>
</figure><figure>
<blockquote>
<p>The best way to learn web development is by building real projects and experimenting with code.</p>
</blockquote>
<figcaption>
— Sarah Johnson, <cite>Web Development Mastery</cite>
</figcaption>
</figure><figure>
<table>
<thead>
<tr>
<th>Month</th>
<th>Sales</th>
<th>Growth</th>
</tr>
</thead>
<tbody>
<tr>
<td>January</td>
<td>$15,000</td>
<td>+5%</td>
</tr>
<tr>
<td>February</td>
<td>$18,000</td>
<td>+20%</td>
</tr>
</tbody>
</table>
<figcaption>Table 1: Monthly sales performance for Q1 2025</figcaption>
</figure>Don't use figure elements for purely decorative images that don't add meaningful content to your page. These images should use regular img tags with empty alt attributes.
While figcaption is optional, it's highly recommended for accessibility. If you're not providing a caption, consider whether the content really needs to be in a figure element.
The figcaption element can only be placed as the first or last child of the figure element. You cannot place it in the middle of multiple items within a figure.
Not every image needs to be wrapped in a figure element. Use them when the visual content is referenced from the main text or when it needs a caption for clarity.
<figure>
<img src="chart.jpg" alt="Sales data chart">
<figcaption>
Quarterly sales increased by 23% compared to last year,
with mobile sales leading the growth
</figcaption>
</figure><figure>
<img src="process-diagram.jpg" alt="Five-step process flowchart from planning to deployment">
<figcaption>Our standard web development workflow</figcaption>
</figure><p>The development process follows five key stages (see Figure 1 below):</p>
<figure>
<img src="development-stages.jpg" alt="Development process diagram">
<figcaption>Figure 1: Five stages of web development</figcaption>
</figure>Do:
Don't:
<figcaption>
User engagement increased 40% after implementing responsive design
</figcaption><figcaption>
Screenshot of the new dashboard interface, showing improved navigation
and streamlined user controls
</figcaption><figcaption>
Figure 3: Comparison of loading times before and after optimization
</figcaption>While this guide focuses on HTML structure, remember that figures and captions can be styled with CSS to match your site's design:
<figure class="centered-figure">
<img src="important-diagram.jpg" alt="System architecture diagram">
<figcaption class="figure-caption">
System architecture showing database, server, and client relationships
</figcaption>
</figure>The HTML5 figure and figcaption elements are essential tools for creating accessible, well-structured web content. They provide semantic meaning to visual content, improve accessibility for users with disabilities, and help search engines better understand your content.
Remember that figure elements are for self-contained content that adds value to your main text, while figcaption provides essential context and description. Use them together to create professional, accessible presentations of images, code snippets, charts, and other visual content.
Start implementing these elements in your current projects by identifying visual content that would benefit from captions or descriptions. Focus on images that illustrate concepts, code examples that demonstrate techniques, and data visualizations that support your content. With proper use of figure and figcaption elements, you'll create more accessible and professional web content that serves all your users effectively.