HTML and CSS Reference
In-Depth Information
• Avoid including phrases such as “image of” or “picture of.”
• Be concise.
Null alt attribute
A null alt attribute is an alt attribute whose value contains no spaces or content. It is
not the same as omitting the alt attribute:
<img src="border_decoration.jpg" alt="" >
Adding a null or empty alt attribute to an image is appropriate in the following
situations:
• The image is purely decorative.
• A text alternative is available immediately adjacent to the image. However, this is
not a valid suggestion if the image is also a link.
• The image is one of a group of images that form a larger picture, and one of the
other images already has the text alternative for the entire picture.
• The image is not meant to be seen by users (e.g., a 1-pixel image that counts page
views).
Alternative text is also not necessary when you use background-image
CSS properties to add a purely decorative image to the web page instead
of using an img element.
The following CSS rule associates an image with a custom class, but the
CSS could be associated with an HTML element, such as the div or
body element:
.border {
background-image: url(border_decoration.jpg);
background-repeat: repeat-x;
}
Since assistive technology may completely ignore images that have a null alt attribute,
assistive technology users will not be made aware of the existence of such
images—which might be exactly what you want, since the image might be, as discussed,
purely decorative without any substantive relation to the web page's message.
However, if you omit the alt attribute altogether from the img element, the same
assistive technologies announce that an image exists on the page and do their best to
provide information about it, even if that information is only the filename. Keep in
mind when considering whether to use a null alt attribute or omit the alt attribute
that there is a difference in how some assistive technologies handle them.
 
Search WWH ::




Custom Search