How to write a caption under an image with HTML?

Spread the love

Sometimes, we want to write a caption under an image with HTML.

In this article, we’ll look at how to write a caption under an image with HTML.

How to write a caption under an image with HTML?

To write a caption under an image with HTML, we use the figcaption element.

For instance, we write

<figure>
  <img src="image.jpg" alt="missing" />
  <figcaption>Caption goes here</figcaption>
</figure>

to call the figcaption element with the caption below the img element in the figure element to add the caption for the image.

Conclusion

To write a caption under an image with HTML, we use the figcaption element.

Leave a Reply

Your email address will not be published.