What are alt attributes useful for?
The
alt attribute is
defined in a set of tags (namely, img,
area and optionally for input
and applet) to allow you to provide a
text equivalent for the object.
A text equivalent brings the following benefits to
your web site and its visitors in the following common situations:
- nowadays, Web browsers are available in a very wide variety of platforms with very different capacities; some cannot display images at all or only a restricted set of type of images; some can be configured to not load images. If your code has the
altattribute set in its images, most of these browsers will display the description you gave instead of the images - some of your visitors cannot see images, be they blind, color-blind, low-sighted; the
altattribute is of great help for those people that can rely on it to have a good idea of what's on your page - search engine bots belong to the two above categories: if you want your website to be indexed as well as it deserves, use the
altattribute to make sure that they won't miss important sections of your pages.
What should I put in my alt attribute?
The generic rule for the content of the
alt
attribute is: use text that fulfills the same function as the image.
Some more specific rules:
- if the image is simply decorated text , put the text in the
altattribute - if the image is used to create bullets in a list, a horizontal line, or other similar decoration, it is fine to have an empty
altattribute (e.g.,alt=""), but it is better to use things likelist-style-imagein CSS - if the image presents a lot of important information, try to summarize it in a short line for the
altattribute and add alongdesclink to a more detailed description
(Source:
http://www.w3.org/)