Accessibility Answers: How Do I Handle Alt Attributes

When I give presentations on accessibility, I often get one or two questions I’ve fielded before. I’ve collected a handful for an ongoing series of posts with my answers. I hope it helps you understand accessibility better.

How do I handle alt attributes?

Alt attributes can trip up even the most seasoned web worker. But do them right, and they make a huge difference to screen reader users.

I like this table from an article by Whitney Quesenbery.

Handle the alt attribute
If the image contains… The alt text should…
Text Repeat the text
Visual information Explain it
Sensory information Describe it
Nothing new Keep it very short
(if you can’t make it “null”)

If you want more explanation, check out the W3C’s alt decision tree.

All images should have an alt attribute, even if it’s empty or null, like: alt="" .