The HTML <figure>
tag is used for annotating illustrations, diagrams, photos, code listings, etc.
You can use the <figure>
element to associate a caption together with some embedded content, such as a graphic or video.
You can use the <figure>
element in conjunction with the <figcaption>
element to provide a caption for the contents of your <figure>
element.
The <figure>
tag was introduced in HTML 5.
<p><a href="#1">Figure 1</a> provides the JavaScript code for creating an alert box:</p>
<figure id="1">
<figcaption>Figure 1. JavaScript Alert Box.</figcaption>
</figure>
HTML tags can contain one or more attributes. Attributes are added to a tag to provide the browser with more information about how the tag should appear or behave. Attributes consist of a name and a value separated by an equals (=) sign, with the value surrounded by double quotes. Here's an example, style="color:black;"
.
There are 3 kinds of attributes that you can add to your HTML tags: Element-specific, global, and event handler content attributes.
The attributes that you can add to this tag are listed below.