My Accessible Website - Blog
Back to Tips

Do I need to include an alt attribute on every image?

If an image on your page isn't really there for any purpose, you might struggle to come up with meaningful alt text for it, so it's quite common to leave the alt attribute off the image tag:

<img src="background.jpg" />

Apart from this technically being invalid HTML, this isn't useful to those how benefit from the alt text.

Some users will be relying on a screen reader to describe the page content to them. When you include alt text for an image, it informs them what the image is.

<img src="search.jpg" alt="Search Button" />

Some images are classed as decorative, meaning that they don't convey any meaning or purpose. If they are just decorative, you actually want the screen reader to ignore them completely because it's just unnecessary noise for the user.

To make a screen reader ignore an image, provide an empty alt attribute. This tells the screen reader to skip it:

<img src="stars.jpg" alt="" />

You might think that not providing an alt attribute at all would cause the screen reader to skip over the image, but that's not the case. Because you haven't instructed it whether the image is decorative or not, it will typically announce that an image is there and, possibly tell the user the filename, which is just confusing.

Always include an alt attribute on your image tags!

Share on Twitter Share on Facebook Share on Google+

Get accessibility tips and tricks in your inbox

Subscribe

Comments