What is the <figcaption> tag in HTML?

Overview

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.

Syntax

<figure>
  <img src="...">
  <figcaption></figcaption>
</figure>

// or

<figure>
  <figcaption></figcaption>
  <img src="...">
</figure>

Attribute support

The <figcaption> tag supports both the global and the event attributes that can be used in HTML elements.

Browser support

The <figcaption> tag supports the following browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

Code example

Let’s see an example of the <figcaption> tag in the following code widget:

Code explanation

In the HTML tab:

  • In line 6, we create a <figure> element and add an image inside, it using the <img> tag.
  • In line 8, we define the caption of the <figure> element, using the <figcaption> tag.

Output

In the output, we see the Educative logo and a caption beneath it, which was added with the help of the <figcaption> tag.

Free Resources