The <figure> tag is used for indicating self-contained content. The tag can include images, diagrams, illustrations, code examples, etc.
The content of the <figure> tag is related to the main flow content. However, it is perceived as an autonomous unit.
To add a caption or explanation to the content of the <figure> tag, we use the <figcaption> tag. The <figcaption> tag is included in the <figure> tag and is placed as the first or last child element. If <figcaption> is the first nested element, then the content will be displayed at the top of the image.
The tag content is written between the opening (<figure>) and the closing (</figure>) tags.
<html> <head> <title>Title of the document</title> </head> <body> <p>A cute baby</p> <figure> <img src="/uploads/media/default/0001/01/25acddb3da54207bc6beb5838f65f022feaa81d7.jpeg" alt="A Cute Baby" width="250" height="200"> </figure> </body> </html>