<figure>...</figure>
HTML4 HTML5
Groups self-contained media content (e.g., illustrations, charts, photos, code snippets) along with an optional caption defined via <figcaption>.
Both opening and closing tags are required.
Attributes: Mostly global attributes are used, such as class, id, and style.
Example
Code:
<figure style="margin: 0; padding: 10px; border: 1px solid #ccc; max-width: 300px; background-color: #fafafa; text-align: center;">
<img src="https://picsum.photos/id/1015/300/200" alt="Mountain valley landscape" style="width: 100%; height: auto; border-radius: 4px;">
<figcaption style="font-style: italic; font-size: 0.9em; color: #555; margin-top: 8px;">Figure 1. Picturesque valley at sunrise.</figcaption>
</figure>
The browser will interpret this code as follows:
Figure 1. Picturesque valley at sunrise.