WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: question about Div tags and content images

for

From: Paul Bohman
Date: Jan 29, 2005 8:19PM


skeegan wrote:
> I am starting to come across websites using DIV tags to load images that
> contain content.

> 2. Is this just an improper use of the DIV tag and should developers be
> made aware that this image and content should be placed using the IMG tag?

I don't think the answer to your second question is as black and white
as some of the replies have made it sound. Using background images may
or may not be inappropriate, depending on how they're being implemented,
and what the purpose of the image is.

If the image is important to the content, then it will need alternative
text. The truth is that there is more than one way to provide
alternative text. The most obvious way is to use a normal tag and
type up some text for the alt attribute. This approach will satisfy the
vast majority of accessibility needs.

However, it is also possible to provide a text description of the image
in the content of the document itself, for all users to see and read. In
this case, if the tag is used, the most appropriate alt text would
be null alt text (alt=""). If the image is loaded as a background image,
then there is no need to provide an alt attribute at all. You could
argue that the image itself is purely decorative in a case like this.
Whether you provide null alt text or load the image in the background,
the functional end result will be the same.

Also, if the image doesn't require any descriptive text all--i.e. it is
purely decorative and doesn't require any kind of text description
either in an alt attribute or in the context of the page--then is there
any harm in loading it in the background? From an accessibility
standpoint, I don't think any harm is being done.

It is only harmful if the image is meaningful and needs a text
description... in which case the developer either needs to use a regular
tag (with alt text) or come up with some other way of providing a
text description of the image (in the context of the document, using an
accessible image replacement technique, etc.).

--
Paul Bohman
Director of Products and Services
WebAIM (Web Accessibility in Mind)
www.webaim.org
Utah State University
www.usu.edu