WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: CSS background image Alt Text


From: Jukka K. Korpela
Date: Jun 27, 2003 4:24AM

On Fri, 27 Jun 2003, Ben Morrison wrote:

> But, how do I specify alt text for [a background] image?

You don't. That's why background images shouldn't be used for actual
content. Remember that they will be omitted when style sheets are
disabled, too. On printing, browsers typically omit background images,
though they might have an option for getting them printed.

> The image says "welcome to dogstar". Could I use:
> #welcome{
> display:none
> }
> <div id="welcome">welcome to dogstar</div>

When CSS is off and images are on, there would be duplication.
When CSS in on and images are off, the message would not appear.

The best approach is to make it a content image embedded via <img>, and
optionally styled. (Advanced browsers, such as Mozilla and Opera, apply
text-related CSS properties to alt texts too.)

On the other hand, is the welcoming message really needed? If there is a
useful heading that tells what the page is about, and adequate contextual
links, then "welcome to..." would not be necessary, just
something auxiliary, presentation rather than content proper.

Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

To subscribe, unsubscribe, or view list archives,
visit http://www.webaim.org/discussion/