Definition
The <figcaption> tag is a child of the <figure> element. It is used to attach a caption to the content within the <figure> element, which may be a piece of code, a photo or image, a video, or even a poem.
Example
<figure>
<img
width="400"
height="225"
src="https://res.cloudinary.com/thewebmaster/image/upload/image/moon-earth.png"
alt="Moon and Earth"
/>
<figcaption>The Moon and Earth in Space</figcaption>
</figure>Usage
- The
<figcaption>element must be a descendant of a<figure>element, and be either the first or last child. - There should only be one
<figcaption>element. - Both the opening and closing tag must be used.
- The
<figcaption>element should contain a caption or legend for the rest of the contents in the parent<figure>element. - For further examples, see the
<figure>element reference article.
Attributes
The <figcaption> element only supports the Global Attributes.
Specification
Browser Support
Desktop
| Chrome | Edge | Firefox | IE | Opera | Safari |
|---|---|---|---|---|---|
| Yes | Yes | Yes | Yes | Yes | Yes |
Mobile
| Android Webview | Chrome Android | Firefox Android | Opera Android | iOS Safari | Samsung Internet |
|---|---|---|---|---|---|
| Yes | Yes | Yes | Yes | Yes | Yes |
