HTML FIGURE and FIGCAPTION Tags
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.
Example of FIGURE and FIGCAPTION Tags
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.
« Previous Tutorial Next Tutorial »
Like/Share Us on Facebook 😋