HTML figcaption Element

HTML <figcaption> Element: Give Media a Meaningful Caption

Visuals speak volumes, but captions give them clarity. The <figcaption> element lets you attach a caption to an image, illustration, chart, code block, or any media within a <figure> element — creating a rich, accessible context.

What Is the <figcaption> Element?

The <figcaption> element defines a caption or description for the content inside a <figure>. It's especially useful for explaining visual elements, making your page more informative and accessible to all users, including those using screen readers.

Basic Syntax

<figure>
  <img src="apple.jpg" alt="Red apple">
  <figcaption>A freshly picked red apple on a wooden table.</figcaption>
</figure>
[ Apple Image ]  
A freshly picked red apple on a wooden table.

Placement of <figcaption>

<figcaption> must be placed inside the <figure> element. It can appear before or after the media content — both placements are valid and semantic.

Example: Caption First

<figure>
  <figcaption>An image showing three types of bananas.</figcaption>
  <img src="banana.jpg" alt="Three bananas: green, yellow, and spotted">
</figure>

Why Use <figcaption>?

  • Improves accessibility: Screen readers announce the caption along with the media.
  • Provides clarity: Especially for complex visuals like graphs or data charts.
  • Helps with SEO: Search engines can index descriptive context.

Example: Code Sample with Caption

<figure>
  <pre><code>console.log('Hello, World!');</code></pre>
  <figcaption>A basic JavaScript statement to print a message.</figcaption>
</figure>

Example: Multimedia Captioning

<figure>
  <audio controls src="cherry-facts.mp3"></audio>
  <figcaption>Listen to 3 quick facts about cherries.</figcaption>
</figure>

Best Practices

  • Keep captions concise but meaningful.
  • Always use <figcaption> inside <figure> — not outside.
  • Pair captions with descriptive alt attributes for full accessibility.

Summary

The <figcaption> element gives your visual and media content a voice — the text that tells the story. You now know how to:

  • Use <figcaption> to describe images, videos, code, or audio
  • Place it correctly within a <figure> block
  • Enhance both SEO and accessibility

Check your understanding 1

What is the main function of the <figcaption> element in HTML?
Choose one answer. You can try again.

Answer and explanation

To provide a caption or description for media content inside a <code><figure></code>

The <figcaption> element is specifically designed to offer a caption or explanation for the media or content enclosed within its parent <figure> element.

Check your understanding 2

The <figcaption> element must be placed inside the <figure> element to maintain semantic correctness.
Choose one answer. You can try again.

Answer and explanation

True

For semantic clarity and accessibility, <figcaption> should be a direct child of the <figure> element, either as the first or last child.

Check your understanding 3

Choose the option that lists all and only the correct statements.

  1. Improves accessibility by providing descriptive context
  2. Helps search engines understand content relationships
  3. Changes the image source dynamically
  4. Groups media and captions semantically
Which of the following are benefits of using <figcaption> for media elements?
Choose one answer. You can try again.

Answer and explanation

Statements 1 and 2 and 4

<figcaption> enhances semantic meaning by linking captions with media, improving both accessibility and SEO. It does not affect image source or dynamic behavior.

Check your understanding 4

Where can the <figcaption> element be positioned inside the <figure> element?
Choose one answer. You can try again.

Answer and explanation

Either at the beginning or the end

The <figcaption> can be placed either as the first or last child inside the <figure> element to provide a caption for the media.

Check your understanding 5

Using <figcaption> improves the experience for users relying on screen readers.
Choose one answer. You can try again.

Answer and explanation

True

<figcaption> explicitly associates captions with media, allowing screen readers to convey the relationship clearly to users.

Check your understanding 6

Choose the option that lists all and only the correct statements.

  1. Text descriptions
  2. HTML links
  3. Images
  4. JavaScript functions
Which of these are valid contents inside a <figcaption> element?
Choose one answer. You can try again.

Answer and explanation

Statements 1 and 2

<figcaption> can contain text and inline HTML elements like links, but should not contain images or scripts.

What’s Next?

Coming up next: the <time> element — where we give dates and durations semantic value and machine readability.

Reaching the recap and completing the quizzes are separate milestones.

    Next lesson: HTML time Element →