In this section, we will learn what <figure> element is and how it works.
What is <figure> Tag in HTML?
HTML <figure> element acts as a container and is mainly used to group an image or multiple images and associate them with a caption.
Within the body of this element, we put one or more images via <img> element and then, for its caption, we use HTML <figcaption>.
HTML <figure> Tag Syntax:
<figure> <img> <figcaption> </figcaption> </figure>
HTML <figure> Tag Values
Usually within the body of <figure> caption, we put one or more images with a caption to associate with.
But remember, we are not limited to just images! We can group other figures like table or code sources etc. in the <figure> element as well.
Example: using <figure> tag in HTML
See the Pen using <figure> tag in HTML by Omid Dehghan (@odchan1) on CodePen.