HTML HTML Tutorial HTML Forms HTML Graphics HTML Media HTML APIs HTML Tags



HTML Tag: figcaption

The <figcaption> tag is used to add a caption to an HTML figure element. The figure element is used to group related content, such as images or diagrams, and the figcaption element provides a description or explanation of the content within the figure element.

The figcaption element is a block-level element, which means it takes up the full width of its parent element. It can be placed inside or outside of the figure element, but it is recommended to place it inside the figure element for better accessibility and semantic structure.

The figcaption element is used to provide a caption or description for a figure element. It is typically used in conjunction with an image or diagram to provide additional context or information about the content within the figure element.

The figcaption element can contain any type of content, including text, links, and other HTML elements. It is important to note that the figcaption element should only be used within a figure element, as it provides context and description for the content within that element.

When using the figcaption element, it is important to consider accessibility and provide descriptive text that can be read by screen readers and other assistive technologies. This helps to ensure that all users, including those with disabilities, can access and understand the content within the figure element.

Here are some examples of how to use the figcaption element in HTML:

Example 1: Basic Usage

An image
A description of the image

In this example, the figcaption element is used to provide a description of an image within a figure element.

Example 2: Multiple Figures

An image
A description of the first image
Another image
A description of the second image

In this example, multiple figure elements are used to group related content, and the figcaption element is used to provide a description for each image.

Example 3: Nested Figures

An image
A description of the image
Another image
A description of the nested image

In this example, a nested figure element is used to group a second image within the first figure element, and a separate figcaption element is used to provide a description for each image.

Activity