What is HTML <figure> Tag?
The HTML figure tag is used to group media content such as images, illustrations, diagrams, or code snippets along with their captions. It is a semantic element introduced in HTML5 that helps organize visual content clearly. The main purpose of the figure tag is to associate the visual media with a caption, usually through the <figcaption> tag. This makes it easier for search engines and users to understand the context of the image or illustration. The figure tag is commonly used in blogs, tutorials, and articles to display labeled visuals or graphics with a descriptive caption. It improves both accessibility and SEO since it provides a meaningful structure for multimedia elements within a webpage.
Syntax of the HTML <figure> Tag
<figure>
<img src="image.jpg" alt="Description of image">
<figcaption>Caption describing the image</figcaption>
</figure>
The <figure> tag starts with the figure element and ends with the closing figure tag. The <figcaption> is optional but recommended for clarity and SEO.
Examples of HTML <figure> Tag
Example 1: Basic HTML Figure Tag
<!DOCTYPE html>
<html lang="en">
<body>
<figure>
<img src="sunrise.jpg" alt="Beautiful sunrise over mountains">
<figcaption>Sunrise view over the mountains</figcaption>
</figure>
</body>
</html>
In this example, the figure tag wraps the image and its caption. The caption describes what the image represents, helping users and search engines understand its meaning.
Example 2: SEO Optimized Figure Tag
<!DOCTYPE html>
<html lang="en">
<body>
<figure>
<img src="web-design.jpg" alt="Professional Web Design Services - Scholar247">
<figcaption>Scholar247 - Best Web Design Services for Modern Websites</figcaption>
</figure>
</body>
</html>
In this SEO-friendly example, the alt text and figcaption include relevant keywords like "Professional Web Design Services" and “Scholar247.” This helps search engines identify the image topic, improving SEO ranking for related searches.
Attributes of the HTML <figure> Tag
The <figure> tag itself does not have any unique attributes. However, the image and caption inside it can use their standard attributes:
• src: Defines the source of the image.
• alt: Adds descriptive text for accessibility and SEO.
• figcaption: Provides a caption or label for the image.
• width/height: Adjusts the size of the image within the figure.
• class/id: Allows styling or JavaScript interaction for layout customization.
Best Practices for HTML <figure> Tag
• Always use the <figcaption> tag to describe your visual content.
• Write meaningful and keyword-rich captions for SEO.
• Use descriptive alt text for accessibility.
• Keep the figure and figcaption visually close in layout for clarity.
• Avoid overusing figures where text alone would suffice.
• Optimize your images for fast loading to improve performance and ranking.
FAQs About the HTML <figure> Tag
What is the purpose of the HTML figure tag?
The figure tag is used to group media content, such as images, illustrations, or diagrams with an optional caption for better structure and understanding.
Is the figcaption tag required inside the figure tag?
No, the figcaption tag is optional. However, it is recommended for providing a description or label for the image, especially for SEO and accessibility purposes.
Can I use multiple images inside one figure tag?
Yes, you can include multiple images inside a single figure tag if they share the same caption or context.
Does the figure tag improve SEO?
Yes. Using the figure and figcaption combination helps search engines better interpret visual content, improving visibility in image and web search results.
Where should the figure tag be placed in HTML?
The figure tag can be used anywhere inside the body tag. It is often placed within articles, sections, or blog posts to display visuals with proper captions.