Choosing Text Equivalents for Images And Image Links
- If an image is active (within and anchor element <a>):
- Alt text should convey the purpose of the link
- If the image contains text, the alt text should be identical to the text in the image
- If image is not active, but conveys information, alt text should convey the information from the image
- If image conveys no relevant information, or is redundant, alt text should be null (alt="")
The following image is from a home page some time back. The code that illustrates the inclusion of alternative text, "the Gateway box", follows.
<img src="box.gif" ... alt="The Gateway box" />
If the Gateway box were an active image, a link to the Gateway home page for example, then the alt-text should give the function of that link, either alt="Home" or alt="Gateway". If the web designer considered the image to be "eye candy", i.e., visually setting a mood, then alt="" might be appropriate since interjecting "The Gateway box" in the flow of a screen reader's speaking of the page might not have an appreciable positive effect.
In the following example from a few years back, the image contains the words "shop IBM" and an abstract shopping cart. The text equivalent should repeat that text.
<img src="images/shop.gif" alt="Shop IBM" />
It might be tempting to write alternative text like this:
alt="abstract shopping cart to the left of the words shop IBM"
That is the description of the image, not its function. If you used that alt-text then each time a blind person visited the site he or she would have to listen to "abstract shopping cart to the left of the words shop IBM." That image and that message would be at the top of every page. Such a description meets the technical standard (Â§1194.22 (a)) for providing a text equivalent, but it fails usability criteria. Instead, use alternative text, as IBM does, that exactly coincides with the text on the image or the function of the link, alt="Shop IBM".
Often, the navigation links at the top of a web page, like the Shop IBM link above, are pictures of the words "Home," "Products," "Customer Service," etc. In these cases as well, the alternative text should be identical to text in the images.
You do not have to include a reference to the fact that something is a link, for example, alt="link to shop IBM page". Text browsers and screen readers inform their users when they encounter a link. So just use alt="shop IBM" and that will do it. It is redundant and questionable to add verbs to the alt-text for links.
For example, Google's typical logo (see above) often (but not always) uses alt="Go to Google Home". When you listen, it sounds like a command; instead, it should just be alt="Google" and a screen reader will announce, "link graphic Google".
The requirement for alternative text also applies to images that carry no information, such as spacer images sometimes used in table-based layout. Use empty or null alt-text, written alt="" (no spaces between the quotes) for the alternative text to say that an image contains no relevant information and is to be ignored.
<img src="images/spacer.gif" alt="" />
This tells an assistive technology, "don't bother me with any information about this image," and the screen reader or text browser will completely ignore the image.
Sometimes you need to make a judgment call about whether or not to use the empty alt-text (alt=""). While blind users may disagree about the correct detail of alternative text, they all agree that the alt attribute must be included on every image.
Another case where you should use empty alt-text is when the information is redundant. In a list of navigation links, for example, you might have an icon next to the text for a link, like a picture of a question mark and the word "Help." In this case, if the image is not a link, it should have empty alt text, alt="".
If that image (question mark) is a link, then alt="" is not appropriate because assistive technology will still include the image link in the tab order and announce the URL (href) of the anchor or other information associated with the anchor like the value of the src attribute of the image. In this situation (and many similar to it) it is best to include the image in the anchor with the text and then you can use alt="" on the image.
Sometimes the information that a screen reader finds because you forgot to include alt text can be downright disastrous. Here is an image from a major internet shopping company that does not, at this time, have alt-text.
This is what a blind user hears:
Another common use of images on commercial web sites is for web designers to create their own bulleted lists using graphics that they choose for the bullets.
Look at the list of global navigation links in the left navigation panel and the News items at the bottom of the .
The arrows are all images with alt="". This is appropriate and the choice made by IBM.
<img src="... arrow.gif" alt="" />
These arrows used to be separate image links. They are not links anymore. When they were separate links, alt="" was not appropriate because the links would be in the tab order and an announcement is needed when screen readers land on a link. When you want to have clickable arrows like this, next to text, then include both the arrow image and the text within the <a> element, with alt="" for the image.
Similarly, the arrows bulleting the News items on the should use alt="" but unfortunately alt-text is not specified.
The used to use ">" as alternative text (alt=">") for some "bullets", but screen readers speak "greater than", which is not good! Other sites use alt="bullet".
In trying to decide whether to use empty alt-text or a short text equivalent, you can listen to your page and decide which sounds better. If the list items are short or if the items are links, alt="" is probably better. If the items are long and they are not links, the alternative text "bullet" might be better.
However, in all of these cases of alt-text for bullets, it would be much better to code the lists as HTML lists (<ol>, <ul>, <dl>) and then there is no issue of alt-text for bullets, and screen reader users will be able to navigate to the list and through the list items. If you use list markup for your lists, then your page will comply with the level one Success Criterion, 1.3.1, of WCAG 2.0 which, in effect, requires the use of structural markup for structures (like lists) on the page. And your lists can look exactly the same as the ones with images included in the text.
For example, again using IBM, here is a screen shot of a list on a .
The code for the list looks something like this:
Then the "bullet" is specified with the CSS style statement like this:
Sometimes images are used purely for visual effect. These should have empty alt-text (alt=""). The disabilities community and disabilities advocates debate this issue. The image on the right-hand side of (from around 2002) is, in my opinion, decorative only. I would use alt="" but the web authors on this site chose alt="Images of NLS Users." Either is OK.
Choosing Text Equivalents for Client-Side Image Map Areas
- Use alt-text for:
- the image map itself
- each area within the map (you need a text equivalent conveying the purpose of the corresponding hot spot on the map)
A client-side image map consists of an image with the usemap attribute set to the name of a map. The image map and each area in the map must have alternative text. The properly marked up HTML code for a client-side image map is illustrated here:
We are going to talk about image maps again in Section 5. For now, however, we want to stress how important it is to include a text equivalent for each area of the image map, a text equivalent that gives the purpose of the corresponding hot spot.
The is notoriously sparse of pictures. They have updated their site since the initial writing of this course, but the first image used to be the Yahoo! banner across the top of the page. (split here for formatting purposes!)
The banner is not a collection of links as it appears. It is one image that is coded as a client-side image map. The links (blue underlined text) in the banner are part of the image. They are not text. The words for the "links" seem to be there, "Calendar," "Messenger," "Check Email," "What's New," "Personalize," and "Help." Here is what Home Page Reader, a talking web browser, tells its users:
The entire banner, including the icons and the simulated-link text, is all one image used as an image map. The map areas are rectangles including each icon and the corresponding text.
None of the map areas have alt-text, as illustrated in this HTML code fragment for the first map area:
<area coords="0,0,52,52" href="r/a1" />
Surprisingly, the portion of the image map offering help was, at the time of the first writing of this course, the only way to find help on the main Yahoo! page. Thus the user who is blind, wanting help, would have to know to follow the link, "r/hw."
You could code the image map hot spots correctly by setting the alt-text to the text that actually appears in the image.
The Yahoo! site that premiered early in 2002 fixed this problem. Their image map hot spots were appropriately marked up with alt-text. Also their form control fields had proper label elements (see the section on forms). Adherence to these basic requirements of Section 508 is all too rare amongst major commercial sites.
The Yahoo! banner has an interesting evolution, starting with a completely inaccessible server-side image map back in 1996, shown below.
In the beginning of 2006 the appearance of the top of the Yahoo! page was banner-like as shown below.
Each of the six images are placed immediately above real text, as opposed to pictures of text in the first Yahoo! banner above. The image and the text are included in the same anchor and the image is given null alt-text, alt="", a recommendation we talked about above for reducing repetition, while including the ease of visually clicking on the image or the text. Here is the (elided) code for one of those links.
<a href=r/25><img src=" ...125.gif" width=36 height=36 border=0 alt="" /><br />... Finance ... </a>
Creating Quality Text Alternatives
- High quality alternative text is just as important as high quality normal text on a page
- Alternative text should be:
It is just as important to have high quality alternative text, as it is to have high quality normal text on the page. The alternative text should be consistent, clear and, most important, useful.
When an image is not a link and carries no information or is redundant, use null alt-text (alt="").
For example, there were many images named c.gif on the that are there for adjusting the visual layout. These carry no information and have been assigned empty alt-text, alt="". Similarly, on the left-side navigation area, there is a list of text links, and each is preceded by a graphical image of an arrow. The alternative text on the image arrow should be and is empty, alt="".
If you do not include the alt attribute with empty text (alt="") for these formatting images, screen readers with the default screen reader settings will ignore the image. However there are screen reader settings that would result in the assistive technology announcing meaningless code to the user. Hearing chatter that carries no useful information can be frustrating and even annoying to a blind user.
When the navigation buttons are images with text, you probably chose that text very carefully. Use the same text in the alt attribute.
Using Long Descriptions for Text Equivalents
- The long description (longdesc) attribute:
- Sometimes needed to provide more explanation or content
- Points to a URL of a file containing the additional information
- Some uses:
- Graphs and charts
- Pictures in news stories
- Images in shopping carts
Alternative text should be short and simple, but sometimes you may need to provide more explanation or content than is suitable for alt-text. In these cases, you can use the long description (longdesc) attribute for the img element. The longdesc attribute points to the URL of a separate description file that contains information conveyed by the image.
<img src="picnic.gif" ... alt="picnic photo" longdesc="picnic.htm" />
The clearest example of the need for a long description of an image is when the image is a graph or a chart as shown below.
<img src="traffic.jpg" ... longdesc="traffic.htm" alt="traffic density graph">
The longdesc attribute points to the file traffic.htm that includes the following simple content:
At first writing of this course the longdesc attribute was not supported by assistive technologies. Because of that, accessibility advocates recommended also using a "d-link" or description link that would open the description file referenced in the longdesc attribute. Now that the technology supports the longdesc attribute there is no need for the "d-link", which is welcome news because even the accommodation itself violates an accessibility principle of having clear link text!
Pictures in news stories or images in shopping sites are also candidates for long descriptions.
There are good alternatives to the longdesc attribute for providing detailed information about images. For example, Reuters news stories displayed on Yahoo.com have photos (as links) with the alternative text "Reuters Photo." That link leads to an enlarged photograph with a detailed description.
When a user opens the "Reuters Photo" link, the following page is displayed.
The long description is a caption on the larger image.