Learn HTML – Part 60 – figcaption Tag – Figure Caption
The HTML figcaption tag is used to define a caption for content inside a figure element.
It provides a description or title for images, diagrams, or other media.
What is the figcaption Tag?
The figcaption element represents a caption or legend for a figure.
It helps users understand the context of the media content.
Basic Syntax
<figure>
<img src="image.jpg" alt="Image">
<figcaption>Caption text</figcaption>
</figure>
Example – Image with Caption
<figure>
<img src="https://via.placeholder.com/300" alt="Sample Image">
<figcaption>This is an example caption</figcaption>
</figure>
Output:
Position of figcaption
The figcaption can be placed before or after the media content.
<figure>
<figcaption>Caption at top</figcaption>
<img src="image.jpg" alt="Image">
</figure>
Why Use figcaption?
- Adds meaningful captions to media
- Improves accessibility
- Enhances semantic HTML structure
- Provides context to users
The
figcaptiontag provides captions for media content inside afigure.
Common Mistakes Beginners Make
- Using figcaption outside figure
- Not providing descriptive captions
- Using figcaption without meaningful content
Conclusion
The HTML figcaption tag is used to add captions to media content inside a figure element.
It improves both usability and accessibility of web content.
What’s Next?
Now that you have learned most essential HTML elements, the next step is to explore the mark tag, which is used to highlight important text.
Next: Learn HTML – Part 61 – mark Tag – Highlight Text →
Series: Learn HTML Series
