Getting started with practical web accessibility, section 1 Twelve simple rules:

Rule 3: Alt texts

Check all images (<img> elements) on the page, and consider whether they have an alternate text (alt attribute) specified and whether that text is adequate. The alternate text is meant for use when the image is not displayed, for one reason or another.

The length of the alternate text should vary from zero to about twenty characters in typical cases. Anything longer is quite often a misguided and misguiding attempt at describing what there is in a picture, rather than proving a text equivalent to it. If an image would need a longer alt text, then the alt attribute is probably not a sufficient method for conveying the message of the image. In that case, you should present the longer text using a different technique.

Using a text-only browser is one way of checking that images have alt texts and that they work well. There is a free text-only browser, Lynx, available for different platforms. You might take an easier way by using an online simulator, “Lynx viewer;” such as Yellowpipe Lynx viewer You specify a page address to it, and it returns a page that corresponds to the page rendering on Lynx, i.e. a linearized view. You could alternatively use the Links browser.

Using a text-only browser or simulator is a good overall checking tool, since it also linearizes the page (see Rule 9) and ignores most formatting. It also gives a rough idea of how the page might behave when read aloud. Moreover, it is similar to the way that search engines “see” the page.

Alternatively, you could read the HTML source of a document and check the <img> elements. However, there is no simple way to detect images from the visual appearance of a page, since some images might actually be backgrounds and some texts might actually be images. Using a text-only browser as the only tool isn’t suitable either; you need to compare the presentation with the graphic appearance of the page.

If there are many images, it can be difficult to check the all the alt attributes. There are utilities that let you view the page graphically but with alt texts shown in a label-like manner. However, this isn’t as convenient as it may sound.

If you view a page on a graphic browser and move the pointer over an image, the browser may display the alt attribute as a “tooltip.” However, this isn’t universal, and the “tooltip” that is shown might actually reflect the value of another attribute (the title attribute). Moreover, how do you know how to identify all the images? Some of them may look like text or buttons or colored boxes—or be completely invisible.

Thus, it is much easier to write good alt texts originally, i.e. when creating a web page. That way, you will think about the textual alternative at the same time that you think about the image and its purpose. Many authoring tools let you write the alt text when you insert an image, but few of them encourage you to do so. Thus, if you use a wysiwyg editor, read its documentation in order to find out how to add alt texts

There is much to be said about alt texts (see e.g. the extensive document Guidelines on alt texts in img elements) but we will start from five basic cases:

There is no excuse for not specifying an alt text for an <img> element, but there are excuses for making such texts less than perfect. Things to be avoided include

There are many software tools for checking that every <img> element has an alt attribute. Even markup validators such as the WDG validator perform such checks, because the alt attribute is syntactically required in HTML. However, such tools cannot check that the attribute values are appropriate and useful. You need to understand the page and the purpose of images in order to evaluate what the alt texts should be.