Alt Text for Logos, Icons and Image Links
When an image is a link or a button, the alt text stops being a description. It becomes the label.
Image links
The HTML standard says that when a link or button has no text, only images, the alt text must together convey the purpose of the link or button.1
Think of the text link you'd write if there were no picture. MDN says to make the alternative text describe the resource the link points to, as if it were a text link.2
The same goes for actions. MDN suggests describing the triggered action, so "next page" rather than "arrow right".2
Don't leave it empty. WebAIM says that when an image is the only content inside a link or button, alt text is all a screen reader has to go on.3
And skip "link to" or "click here for". WebAIM says screen readers already announce links as links.3
When the link has text as well
If the image and a text caption sit inside the same link, the text already names the destination. WebAIM says the image can then have an empty alt attribute to avoid redundancy.3
Logos
The HTML standard splits this by use.
- The logo stands for an organisation, say as a page heading: the alt attribute must contain the name of the organisation. It shouldn't include the word "logo".1
- The logo sits beside the name it stands for: the logo is supplemental, so its alt attribute must be empty.1
WebAIM's advice for a logo that links to the home page is the same. Alternative text such as the company name will usually do.3
<a href="/"><img src="logo.png" alt="Acme Company"></a>
Icons
Icons come in two kinds.
An icon with a text label beside it. The icon repeats the label, so the alt attribute must be present but empty.1
An icon on its own. The standard says that when the icon has no text next to it describing what it means, an equivalent textual label must be given in the alt attribute.1
WebAIM works through a link with a PDF icon. If the icon is the only thing in the link, the alt text would need to fully convey the content and function of the link and image together.3
Image buttons
WebAIM says a form button that is only a picture of text should be replaced with real text, styled with CSS as desired.3 CSS is the stylesheet language that sets how a page looks.
If you can't avoid the image, the alt text should describe what the button will do when activated. WebAIM's examples are "Search", "Submit", "Register" and "Place your order".3
<input type="image" src="go.png" alt="Search">
A quick table
| The image is | The alt text |
|---|---|
| A logo standing for the organisation | The organisation's name, without "logo"1 |
| A logo next to the organisation's name | Empty1 |
| An icon next to a text label | Empty1 |
| A lone icon that works as a link | The action or destination2 |
| A picture-only button | What the button does3 |
For the general rules, try the six-step method. The code itself is on the HTML page.
Reference list
- HTML Standard, the img element and alternative text, WHATWG
- <img>: The Image Embed element, MDN Web Docs, Mozilla
- WebAIM: Alternative Text, WebAIM, Utah State University