HTML <figure> and <figcaption> Tag

HTML <figure> Tag

The HTML <figure> tag is a semantic tag that represents self-contained graphical content such as illustrations, diagrams, photos, etc. For example,

<figure>
    <img src="https://cdn.programiz.com/sites/tutorial2program/files/pc_logo.svg" width = "300" height = "247">
</figure>

Browser Output

HTML Figure element with an image

HTML <figcaption> Tag

The HTML <figcaption> tag is used to define the caption for a figure. It is placed as a child element of the <figure> tag along with the content. For example,

<figure>
    <img src="https://cdn.programiz.com/sites/tutorial2program/files/pc_logo.svg" width = "300" height = "247">
    <figcaption>Learn to code for free.</figcaption>
 </figure>

Browser Output

HTML Figure element with an image and a caption