(Reading time: 1 minute)

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.

  

 
 
 
<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>
 
 
 

 

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

alt text
My Caption one
alt text
My Caption two

 

 


Chillzee Tag Cloud

Let's Socialize

About Chillzee

Chillzee.com is an entrepreneurship portal.

The site provides informative topics on Organizational and Strategic needs.