In HTML
, the <figcaption>
tag is used to define the caption of the <figure>
element. It is added as the last or the first child of the <figure>
element in a document.
<figure>
<img src="...">
<figcaption></figcaption>
</figure>
// or
<figure>
<figcaption></figcaption>
<img src="...">
</figure>
The <figcaption>
tag supports both the global and the event attributes that can be used in HTML
elements.
The <figcaption>
tag supports the following browsers:
Let’s see an example of the <figcaption>
tag in the following code widget:
In the HTML tab:
<figure>
element and add an image inside, it using the <img>
tag.<figure>
element, using the <figcaption>
tag.In the output, we see the Educative logo and a caption beneath it, which was added with the help of the <figcaption>
tag.