HTML figcaption Tag
Last Updated :
27 Nov, 2024
Improve
The <figcaption> tag in HTML is used to provide a caption or description for a <figure> element.
- This tag is typically used to describe an image, illustration, chart, or any other content that requires an explanation.
- It helps to improve accessibility and search engine optimization (SEO) by associating descriptive text with visual content.
- The
<figcaption>
element can be placed as the first or last child of the <figure> element.
<!DOCTYPE html>
<html>
<body>
<figure>
<img src="https://media.geeksforgeeks.org/gfg-gg-logo.svg"
alt="gfglogo">
<figcaption>
GFG logo
</figcaption>
</figure>
</body>
</html>
Syntax:
<figure>
<img src="image.jpg" alt="Description of the image">
<figcaption>This is the caption or description of the image.</figcaption>
</figure>
Note: This tag is new in HTML5. The <figcaption>
tag also supports the Global Attributes and Event Attributes in HTML.
More Example:
<!DOCTYPE html>
<html>
<head>
<style>
figure {
text-align: center;
margin: 20px;
}
figcaption {
font-style: italic;
color: #555;
margin-top: 5px;
}
</style>
</head>
<body>
<figure>
<img src="https://media.geeksforgeeks.org/wp-content/uploads/20241127115934034573/lack.jpg"
alt="A beautiful landscape with mountains and a lake" width="200">
<figcaption>
A stunning view of the mountains reflecting in the lake at sunset.
</figcaption>
</figure>
<figure>
<img src="https://media.geeksforgeeks.org/wp-content/uploads/20241127115934261155/forest.jpg"
alt="A serene forest with tall trees and sunlight filtering through" width="200">
<figcaption>
A tranquil forest scene with sunlight streaming through the trees.
</figcaption>
</figure>
</body>
</html>