DEV Community

Discussion on: Why you should never ignore the alt attribute

Collapse
 
rokuem profile image
Mateus Amorim

And for captions, we can use the HTML tag

 <figure>
  <img src="someimg.jpg" alt="some alt text">
  <figcaption>Some description</figcaption>
</figure> 

Depending on your html structure and the importance of the caption, you may also do it like this:

<img src="assets/someImg.jpg" alt="" aria-described-by="description">
//...
<p id="description" >
  //...
</p>