<figcaption>...</figcaption>
HTML4 HTML5
Defines a caption or legend for a <figure> element (e.g., image, diagram, code snippet). Must be the first or last child inside a <figure> container.
Both opening and closing tags are required.
Attributes: Global attributes are primarily used, such as class, id, and style.
Example
Code:
<figure style="margin: 0; max-width: 300px; text-align: center;">
<img src="https://picsum.photos/id/1018/300/200" alt="Mountain landscape" style="width: 100%; height: auto; border-radius: 4px;">
<figcaption style="font-style: italic; font-size: 0.9em; color: #555; margin-top: 5px;">Figure 1. Mountain landscape in the morning.</figcaption>
</figure>
The browser will interpret this code as follows:
Figure 1. Mountain landscape in the morning.