In the world of web accessibility, it’s the little things that make a big difference. And when it comes to elements with role=img, one of the most important little things is the alternate text. Alternate text is a short, descriptive label that tells screen readers what the image is about. Without alternate text, your images can be a confusing and frustrating experience for users who are blind or have low vision. This guide will explore the importance of alternate text for elements with role=img and how to fix it.
Think of your images as a book. You want to make sure that everyone can read it, regardless of whether they are sighted or not. The same is true for your website. By giving each image a unique and descriptive alternate text, you can create a more accessible and user-friendly experience for everyone. For a deeper dive into the world of accessibility, see our article on accessibility.

Your Guide to a More Accessible and User-Friendly Website
Fixing missing alternate text for elements with role=img is a simple but important task. Here’s how to do it:
- Identify Your Elements with role=img Without Alternate Text: Use an accessibility testing tool like Creeper to crawl your site and identify any elements with role=img that are missing alternate text.
- Add Alternate Text to Your Code: You can add alternate text to your elements with role=img by using the ‘aria-label’ or ‘aria-labelledby’ attribute. The ‘aria-label’ attribute should be used to provide a short, descriptive name for the image. The ‘aria-labelledby’ attribute should be used to point to the ID of the element that contains the image’s title.
The SEO Power of an Accessible Website
An accessible website is a more successful website. By making your website more accessible, you can improve your user experience, reach a wider audience, and even improve your SEO. For more on the importance of a well-structured website, check out this guide to the img role from MDN.
Don’t let your images be a mystery to your users. By taking the time to give them alternate text, you can build a more accessible and successful online presence. For more on how to create a winning on-page strategy, see our article on on-page SEO.

Frequently Asked Questions
What is the role=img attribute?
The role=img attribute is used to indicate that an element is an image. It’s often used for things like icons, logos, and other types of graphical content.
Why is it important for my elements with role=img to have alternate text?
It’s important for your elements with role=img to have alternate text so that screen readers can announce the purpose of the image to the user. This is crucial for users who are blind or have low vision.
How do I add alternate text to my elements with role=img?
You can add alternate text to your elements with role=img by using the ‘aria-label’ or ‘aria-labelledby’ attribute. The ‘aria-label’ attribute should be used to provide a short, descriptive name for the image. The ‘aria-labelledby’ attribute should be used to point to the ID of the element that contains the image’s title.
Ready to make your images more accessible? Start your Creeper audit today and see how you can improve your use of alternate text.