HTML <figcaption> Tag
To provide a caption to an image, the HTML <figcaption> tag is used. It is placed either before or after the content within the <figure> tag, thus can be placed either as the first child or the last child of the <figure> element, but it is not mandatory to be used with the <figure> tag. Within a <figure> tag, only one <figcaption> element can be nested.
Example:
<!DOCTYPE html> <html> <body> <h2>Example:</h2> <figure> <img src="img.jpg" alt="Fly" width=300 height=200> <figcaption>Fig.1 - Fly high in the sky.</figcaption> </figure> </body> </html>
Explanation:
In the above example, we are using the HTML <figcaption> tag, to provide a caption to an image.
Global Attributes:
The Global attributes are supported by the HTML <figcaption> tag.
Event Attributes:
The Event attributes are supported by the HTML <figcaption> tag.
Supporting Browsers:
Chrome, IE, Firefox, Opera, and Safari.