HTML - How can I add a caption under an image?

HTML

HTML5 offers a great tag <figure> to make life easy for web developers.

 

Say you have a couple of images and would like to add a caption under each image, we can use <figure> tag to accomplish this easily.

  

{code}

<center>
<a href="#">
<figure>
<img src="/images/linux.jpg" alt='alt text'>
<figcaption>My Caption one</figcaption>
</figure>
</a>
<a href="#">
<figure>
<img src="/images/linux.png" alt='alt text'>
<figcaption>My Caption two</figcaption>
</figure>
</a>
</center>

{/code}

 

The above code will look like the following text in the browser:.

alt text
My Caption one
alt text
My Caption two