Re: Why does it say ALL images need alt tags?

Aziz Matar <> wrote:

>I can understand how alt tags help, but for some images that are used as
>part of the sites navigation, for example, a small 10x10 square that is
>used to draw a curve and placed on the corner of your tables for
>decoration, why does the validator want alt tags on those?

As has been mentioned, an alt attribute is mandatory on all img tags. The
reason for this decision in the standard was presumably to provide for
"gracefull degradation" when images are not displayed for some reason
(turned off, text mode browser, speech browser, etc.).

This also implies the answer to your second question. Since the contents of
the alt attribute is meant to replace the image when the image is not
displayed, and the images in question have no meaning -- they're pure
decoration -- just use an empty alt attribute: <img src="foo.png" alt="" />

For images that do have some meaning you need to find a suitable
replacement text. e.g. if you have a company logo that is also a link to
the home page, suitable replacements might be the company name or the words
"home page". If you have a stylized question mark indicating a help page,
the text "Help" might be appropriate.

"When you have no nails your hammer grows restless, and you begin to throw
 sideways glances at screws and pieces of string."    -- Jarkko Hietaniemi

Received on Monday, 11 November 2002 00:34:27 UTC