The FIGURE tag is newly introduced in HTML5 and is used to group or annotate various diagrams, images, illustrations, and code snippets.
You can define various tags, such as IMG, CODE, and PRE, inside the FIGURE tag. The FIGCAPTION tag is used inside the FIGURE tag to provide the caption of the content.
Following is an example of using the FIGURE and FIGCAPTION tags.
<FIGURE> <FIGCAPTION>Listing 1: Showing the alert box</FIGCAPTION> <PRE><CODE>alert('Hello World!');</CODE></PRE> </FIGURE>
In the above example, we have defined the FIGURE tag, which contains the FIGCAPTION tag to display the figure caption on a Web page. In addition, we have also defined the PRE and the CODE tags to display the code in the predefined formatting.