← Back to all elements

The <figure> and <figcaption> Elements

The <figure> element is used to semantically group media or content with an associated caption, while <figcaption> provides the caption. This improves accessibility and gives meaning to images, code snippets, and quotes.

When to use it

Use <figure> and <figcaption> to add captions to images, code snippets, charts, or quotes.

They are especially useful in content management systems, blogs, and documentation sites where captions are needed for various types of content.

Screen readers can announce the caption as related to the content, improving accessibility.

Live Demo & Code