📜  HTML figcaptiontag(1)

📅  最后修改于: 2023-12-03 15:01:09.657000             🧑  作者: Mango

HTML figcaption Tag

The HTML figcaption tag is used to provide a caption or title for a figure element in an HTML document. It is used to add a description or explanation to a figure, table, or image. The figcaption element must be placed within the figure element.

Syntax
<figure>
  <img src="example.jpg" alt="Example Image">
  <figcaption>
    This is an example image.
  </figcaption>
</figure>
Attributes

The figcaption tag supports the following attributes:

  • align: Specifies the alignment of the figure caption. This attribute is not supported in HTML5.
Example
<figure>
  <img src="https://via.placeholder.com/150" alt="Example Image">
  <figcaption>
    This is an example image.
  </figcaption>
</figure>

The output will be:

Example Image

Fig. 1: This is an example image.

Conclusion

The figcaption tag is an important element that should be used to provide a caption or title for a figure. It helps users understand what they are viewing and makes it easier for them to understand the content of the document. Always remember to include the figcaption tag within the figure element.