Tag figcaption

The <figcaption> tag is used to provide a caption (description or label) for the content inside a figure element, such as an image, diagram, illustration, or chart.

It helps improve semantic meaning and accessibility, giving context to the media for all users, including screen readers.


✅ Basic Syntax

<figure>
<img src="sunset.jpg" alt="A sunset over the mountains">
<figcaption>A beautiful sunset over the Rocky Mountains.</figcaption>
</figure>

📍 Result:
Displays an image with a descriptive caption underneath.


🧩 How It Works

  • <figure> groups the media and the caption together.
  • <figcaption> gives the media a clear, accessible label.
  • You can place <figcaption> before or after the media element inside <figure>.
<figure>
<figcaption>Logo of the website</figcaption>
<img src="logo.png" alt="Website logo">
</figure>

🎨 Styling Example

figure {
border: 1px solid #ddd;
padding: 10px;
width: fit-content;
margin: 20px 0;
}

figcaption {
font-size: 0.9em;
color: #555;
text-align: center;
margin-top: 5px;
}

✅ Use Cases

  • Images with explanatory text
  • Charts or graphs with titles
  • Videos with context
  • Code snippets or illustrations that need a caption

📌 Accessibility Tip

Always pair your <figure> with <figcaption> if the visual content needs explanation. This helps both search enginesand assistive technologies better understand the content.


✅ Summary

Tag<figcaption>
PurposeProvides a caption for a media figure
Parent tagMust be used inside <figure>
PlacementBefore or after media content
Semantic✅ Yes
StylingCan be styled like any other text