Examples for the use of the «alt» attribute
Many sites are full of images, use complex page layout, sophisticated browsing tools like scripts and applets. Indeed, those elements can bring much to a site: a nice presentation, a more pleasant layout, further browsing tools and additional information.
Unfortunately, those elements can make a site totally inaccessible if a certain number of simple precautions are not taken.
The basic technique consists in providing a comment of non textual elements (this comment is called «alternative content»). HTML 4 introduces a «title» attribute, which can be applied to almost all the HTML elements and enables to give them a title.
As far as images are concerned, you often just have to use the «alt» attribute of the «IMG» element. Through this attribute, a brief description of the image is pointed out. This text should be short and primarily indicate the purpose of the picture. For example, if an image representing a magnifying glass is a link to a page whose aim is to search for information, you had better use «search» as a comment instead of «magnifying glass».
In the case of information giving images, that are more complex, it may be necessary to provide a description of the image with more details. Then, several methods are possible. A complete description of the picture can be placed in an associated page. This description will be referred to in the «longdesc» attribute. A description link can also be placed next to the image (only with the text «D»), or the «OBJECT» element can be used (all browsers do not support neither the «longdesc» attribute nor the «OBJECT» element, which have appeared in the latest W3C recommendations. Consequently, the most efficient technique is to use the descriptive links).
Long descriptions are required when images are necessary for the understanding of the information (for instance tables and graphics). They are recommended in case of photographs or complex images.
An alternative content is not only necessary in case of images :
Back : Recommendations