Skip to page content or skip to Accesskey List.
Search evolt.org
evolt.org login: or register

Work

Main Page Content

Alt and beyond: Making web graphics accessible.

Rated 3.8 (Ratings: 13) (Add your rating)

Log in to add a comment
(22 comments so far)

Want more?

 
Picture of wiseguysonly

Tim Roberts

Member info | Full bio

User since: August 17, 2002

Last login: August 17, 2002

Articles written: 3

Alt and beyond: Making web graphics accessible

Many developers still view graphics and accessibility as being on opposing ends of the web development scale. The truth is that including graphics in your documents does not mean your page has to be any less accessible. In fact, as we will see later in this article, graphics can be used to enhance the accessibility of a page. There are, however, a few key techniques that you can employ to ensure that you don't have to construct alternative "Text-Only" documents. The web truly is the last frontier where we can treat all people equally with "one size fits all" web documents. There is just a little bit extra we need to do to achieve this.

What's the alternative?

A key technique in producing accessible graphics in your web documents is utilizing the alt attribute. For every image that appears on your site you should include the alt attribute with no exception. Shortly, we will see how easy it is to root out missing alt attributes and also why we should take care in crafting alternative representations of our site graphics. Firstly though, lets find out what the alt attribute does.

Employing an alt attribute in your image tag is this simple:

<img
  src="logo.gif" alt="logo" />
. What this actually does is to provide a textual representation of your graphic for users who do not have graphical browsers. Such users include blind and low vision people whose screen readers will audibly render the value of the alt attribute or text only browsers such as lynx that will render the alt text only. This technique is not only of benefit to users with disabilities. Mobile Internet devices are becoming increasingly popular, and many still don't render graphics but can deal with alt attributes.

By now, I am hoping you are sold on using alt attributes for every image on your site. If you are, the first thing you will want to do is root out all the missing tags around your site. Using Watchfire's Bobby this is an easy task. Just punch in your URL and scan the resulting report for Priority 1 errors. This is where you will be able to find out exactly how many instances of missing alt attributes are on your site, and where you will find them. Now we have a list of offenders and we can deal with them accordingly.

Telling it like it is

Of course, you can just enter empty alt attributes and Bobby would not find any errors. But that would achieve nothing in reality other than wasting your own time. If you don't use the alt attribute correctly you may as well not use it at all.

The first rule of alternative text is to make it coherent with the image. The biggest misuse of alt is to put a snappy caption or joke reference that doesn't necessarily have any reference to the image it is associated with. Don't do it. An alt attribute is the only way someone without a graphical browser can make sense of an image, so you shouldn't waste it. Be straight to the point, but most of all "represent".

Look at these two tags for images:

&lt;img src=&quot;logo.gif&quot; alt=&quot;logo&quot; /&gt;<br>
  
&lt;img src=&quot;logo.gif&quot; alt=&quot;WiseGuysMedia: accessibility
  consultations&quot;&gt;

The first one is better than nothing, but the second one is so much better. It tells you a great deal more about what my logo is and the text also looks good at the head of every page in a text only browser.

The importance of alternative representations is clear when they are used for navigation buttons. Without a textual representation, non-graphical browsers will not be able to tell the user anything about the link other than the full URL of where it points to. The user will not be able to get around your site and hence won't be hanging round for long. If you use individual images for image maps as navigation then you should also ensure that you don't just give an alt attribute to the main image. You need to add alt attribute to the "hotspots" in the map also like this:

Navigation.

Another thing to watch out for with alt attributes is images that appear side by side. Look at this code:

&lt;img src=&quot;dog&quot; alt=&quot;my dog eating&quot;&gt;<br>
  &lt;img src=&quot;cat&quot; alt=&quot;my cats head&quot;&gt;

For a text only browser, and screen reader the out put would be along these lines.

"my dog eating my cats head"

Besides landing you in trouble with animal rights activists, it can also be very confusing. When you are rendering images side by side, end each alt attribute with a simple full stop to put everything in context.

Above, I stated that every image should have an alt attribute. This includes spacers and images that do not convey any meaning whatsoever. This is one occasion when you can leave the value of the alt attribute empty:

&lt;img src=&quot;spacer&quot;
  alt=&quot; &quot; /&gt;
. The reason for doing this is that every time a text only browser or screen reader or text-only browser comes across an image, it will render the filename if no alt attribute is present. This can be very annoying and also confusing. So for images that really have no purpose other than decoration, an empty alt attribute will render nothing. This is much better than listening to the file name of every decorative image on your site. Naturally, the CSS / XHTML puritans amongst us will tell you that you should be using CSS for positioning and decoration as opposed the older methods of spacer images - they have a point.

If a picture paints a thousand words...

Before you run off and start plastering your site with alt attributes, just remember that a good rule of thumb with them is to be concise and to the point. Some pictures require more than several words to describe them and this is where we need to go beyond the alt attribute.

Consider this scenario. I have a picture of my favorite piece of art. To render it textually I could put this:

&lt;img src=&quot;art.gif&quot; alt=&quot;My favorite piece of art&quot;
  /&gt;

OK, it does have an alt attribute, but it doesn't really tell you much. On the other hand, I could always do this:

My favourite piece of art, The Raft of the Medusa. 
It depicts the helpless passengers and crew of the French ship Medusa.
The large canvas (16 by 23 feet) with its twisting figures in desperate 
hope at the sighting of a rescue ship

It works, sure, but it makes my (X)HTML bulky and maybe my site user doesn't want to listen to or read all of that description. There is a solution. It's another attribute we can connect to image tags when the image requires a longer description. It is imaginatively titled the longdesc attribute. The beauty of this attribute is that you can still use and alt attribute along side a long description attribute that references a separate more detailed textual representation of the image. You do it like this:

&lt;img src=&quot;art.gif&quot; alt =&quot;My favorite piece of art:
  long description available&quot; longdesc=&quot;medusa.html&quot; /&gt;

All I need to do now is create a separate html document with a longer description of my image called "medusa.html".

A caveat, as always

Whatever standards we have at our disposal, it is the browsers and user-agents that give us real world constraints. With longdesc, this is still a question of support. Newer assistive technologies can handle the longdesc attribute, but many browsers still don't support it. At the National Center for Accessible Media, a technique that has become widely recognized has been developed to overcome this problem. The technique is to place a link to the long description around an uppercase [D] directly below the associated image. Whilst this is not a standard, it is widely recognized amongst the disabled community. The output would look something like this below the image: [D] with the link pointing to your long description document. You can also use a title on the link such as title="This links to a longer description of the image above" to give the user another clue.

Accessible Graphics revisited

So far we have concentrated on supplying alternative text for graphics, but we can also use guidelines that help us make graphics more accessible for browsers that can render them. There are many circumstances where users with disabilities can see your graphics, but care must still be taken to ensure they do not impede their ability to use your web documents.

Although we can alternatively represent it, try to limit the amount of text you include in your graphics. Some low vision users view web documents through screen magnifiers. When the text in graphics is zoomed in, it can appear very distorted of blurred. If you are going to use text in graphics, the following guidelines can help make them more accessible:

  • Make fonts sizes as large as possible.
  • Use simpler block fonts and avoid anti-aliasing if possible.
  • Use good color contrast between the text and background.

For users with dyslexia or other learning difficulties, graphics can be both the best and the worst of the web. Complex instructions can be represented by graphics that would be much simpler for a user with a learning difficulty to comprehend. Examples include technical data or guides to completing a web payment process. However, very bright or animated graphics can easily distract a dyslexic user from content on your site and make it difficult for them to concentrate. Section 508 advises that images should not flicker between 2 and 55 times per second. That is basically one major change per second.

Developing accessible web sites should not be about sacrificing your design and graphics. Ensuring that every image is represented alternatively and correctly is far more important than removing it from your site. A little care and attention to the actual design of your graphics can also assist not only users with disabilities, but also every user of your web documents,

Tim Roberts runs a personal site devoted to accessible web design and other day to day issues called WiseGuysOnly.

He is originally from the rainy North of England, but now lives under the Sunshine of Spain's Costa del Sol. In his spare time he works as Senior Developer for Reliant Webs, looks at the stars and watches lots of videos.

Empty ALT attributes

Submitted by bmason on October 25, 2002 - 17:18.

I believe it is better form to have a null ALT attribute for those appropriate graphics like the classic spacer.gif, not one with a space. Internet Explorer will render the space as a tooltip, and readers may attempt to read out the space. If you want a null tag, don't put a string with content in it -- including a space.

login or register to post comments

Alt attribute contents

Submitted by JohnLloydJones on October 27, 2002 - 10:51.

As Tim points out, it's not enough to have al alt="" text, it needs to make sense to the user in the context it is presented. Hearing a screen reader say "Logo" doesn't convey much. Ideally, the text should, to the extent possible, convey to the user what the image is intended to communicate: e.g: "Picture of Arctic terns flying over the bay", "Details of the release mechanism, showing the worn edge". Writing micro-content is difficult, but filling alt="" attributes with empty phrases may fool tools like Bobby, but is doesn't make the page more accesible.

login or register to post comments

Re: Alt attribute contents

Submitted by bmason on October 27, 2002 - 12:18.

In my opinion, what you've written there as examples of alt text is good title text, bad alt.

The alt text needs to convey the same message as the graphic for when the graphic is not available. The hypothetical designer here is (hopefully) not trying to use the graphics to say:

  • "I am a picture of Arctic terns over the bay."
  • "I'm a detail shot of the release mechanism, showing the worn edge."

The message shouldn't describe what this image is (a picture of thing X); it should convey the message of the image's content (thing X). I'd rather see text that reads:

  • "Arctic terns can often be seen flying over the bay."
  • "The release mechanism had a worn edge."

And if this information was already in the body of the text, my alt attributes would be null.

I like to test my alt text by having a screen reader read the page to me, or I read it aloud from Lynx. If the text is both gramatically correct and makes sense sematically, then I'm probably satisfied with my writing.

login or register to post comments

Re: Alt attribute contents

Submitted by JohnLloydJones on October 27, 2002 - 12:49.

Getting the text right is difficult -- exactly what I was trying to say. What is the page designer trying to say with the image? Why did the author show an image with a worn edge? Possibly to reinforce the text on the page -- "here's my evidence, look the edge is worn". In that case, we should probably state that in the alt text. Re-stating the bland fact that the edge was worn, might not further the cause. I can also think of cases where it might -- context would decide. And yes, the ideal is to "view" the page with a screen reader or text only user agent and confirm that the text works in that context.

login or register to post comments

More Checks That You Can Do...

Submitted by g1smd on October 27, 2002 - 13:32.

You can also get a list of missing ALT attributes, whilst at the same time checking the structure of your HTML document, and listing many other types of errors, by visiting http://validator.w3.org/ and getting it to scan your pages.

login or register to post comments

Alternate Opinion

Submitted by technophobe on October 28, 2002 - 02:21.

according to the RNIB the best use of alt for spacer tags is alt="*" this informs the user that their is an image there, but that it is 'eye-candy' and can be ignored. also making font-size as large as possible, is definately a bad idea, image being only able to see 1 square inch of the screen, then imagine text 1inch high... ...difficault to read? i'll say... best to let users define their own font sizes. j

login or register to post comments

alt vs. title?

Submitted by notabene on October 28, 2002 - 02:35.

Am I the only one to use title in map areas rather than alt?

According to the W3C spec it seems that alt should be considered a primary attribute, somehow, and title nearly comes as a side note, listed in Attributes defined elsewhere.

For me a title applies to a link (hence a href and area href) and an alt applies to an image.

Am I applying standards wrongly? What do you think out there?

login or register to post comments

A few responses.

Submitted by wiseguysonly on October 28, 2002 - 02:54.

I actually (controversially or not) disagree with the RNIB's suggestion of using alt="*" for images which have no use other than pure decoration. The screen reader or text browser will pick them up, but there really is no need for the blind or low vision user to know they are there if they are of no importance to the document. Using * the image will not be ignored by a text-only browser or screen-reader and can be frustrating to a blind user. It is better to say nothing at all than to tell them about every image that bears no importance. One place where the * could be used is for images on bulleted list,as it created a better visual in text-only browsers. Although it is much better to use CSS and proper list tags to format lists becasue they will appropriately represented by the assistive technologies. Giz's point about using the W3 validator is valid in itself. The alt attribute is part of the (X)HTML standard. However, I chose to refer users to Bobby as it is a specific tool to accessibility and picks up many other issues that the W3 validator will not. On image maps use the alt attribute. If you use a title attribute you are really only duplicating what you have done in your alt attribute. You don't have to use a title attribute on image maps to validate - however, the alt attribute is a neccessity. They are images afterall and have potential to be inaccessible. As far bmasons comment goes, either is really ok. Screen readers generally don't try to read out empty alt attribute. I have to disagree with any worry about the displaying of tooltips. Worrying about tooltips is not an option here, as they are of no importance to accessibility and generally are quirk of browsers. The alt attribute's core purpose is to represent an image alternatively, not to display a pretty tooltip for sighted users.

login or register to post comments

Sorry about 1 paragraph.

Submitted by wiseguysonly on October 28, 2002 - 02:55.

PS. I am sorry about one paragraph up there. I am used to using MovableType for posting and forgot evolt requires the tags manually coding.

login or register to post comments

RNIB and *

Submitted by technophobe on October 28, 2002 - 03:03.

sorry to be a pain

do you realise how anoying it is to have a screen reader say 'image' and not know whether its eye-candy, a spacer, or the coder forgot the alt tag?

that is why it is very important to have the 'alt="*"'', this gives vital information to the blind or non-sighted user

do you actually try your code in a screenreader?

login or register to post comments

Screen Readers.

Submitted by wiseguysonly on October 28, 2002 - 03:53.

I personally use pwWebSpeak, a very good, free screen reader. In this tool, empty / null alt attributes are not rendered

I think that the argument is an open one that you will also find raging in the W3 lists. It is basically how dependent on how important you think it is for a non-sighted user to be made aware of the existence of an image that is purely display orientated and has no bearing on the content of a document. Let me state again, in my article I refer to the use of transparent spacer images. This could be used to push certain elements into fixed positions. For screen-readers or text ontly browsers, this is worthless and adds useless content to the page. If you think however that a purple horizontal line image is really important you can use alt="purple horizontal line.". It is all a question of how you, the page author, views the importance of parts of your document.

From the JAWS manual:

Graphics that include a "null" or empty alt text value are ignored even if you have JAWS set to announce all graphics.

You will find that most screen-readers are built to approach empty alt attributes in this way as well as text-browsers such as lynx.

It is not a crime to use either method. They are at the very least more accessible than nothing.

login or register to post comments

fair

Submitted by technophobe on October 28, 2002 - 03:58.

enough :)

login or register to post comments

Making font size as large as posible.

Submitted by wiseguysonly on October 28, 2002 - 04:03.

From technophobe.
also making font-size as large as possible, is definately a bad idea, image being only able to see 1 square inch of the screen, then imagine text 1inch high... ...difficault to read? i'll say... best to let users define their own font sizes.
Of course users should be allowed to define their own font size, but in graphics that is not possible. The idea behind making fonts large is for graphics where a user cannot adjust the size. They may be able to enlarge text fonts in the document and still view the image text without the use of a magnifier. This is why I say make "GRAPHIC TEXT" as large as possible. And of course "as possible" means within the constraints of your design.

The technique also refers to using fonts that are not anti-aliased if possible also. This is so that if you need to use smaller fonts in your graphics and they are to be maginified, they appear much clearer.

login or register to post comments

Alt text as content

Submitted by aslsw on October 28, 2002 - 19:08.

I am trying to encourage our content authors to think of alt text as content.

This means that they should actively look at images (particularly graphs), think about what the image is conveying to sighted users, and write the alt text accordingly. In other words, treat the alt text as seriously as they treat any other piece of content.

Where this gets hard is in some of the photos people like to use. Why did they want a picture of a mum and dad and 2 kids? Because it looks nice? Well, actually, because our organisation delivers programs for families - so why not say that?

Having said that, I still see heaps of "logo" alt text!

login or register to post comments

What about title?

Submitted by codepo8 on October 29, 2002 - 10:57.

I am a bit confused about title and alt. Especially Mozilla does not render alt text as a popup but the title one. Any thoughts on that?

login or register to post comments

Re: What about title?

Submitted by bmason on October 29, 2002 - 11:17.

Mozilla doesn't popup alt because that's not what alt is for. If the graphic is not available for whatever reason, alt stands in as the replacement content. That's it.

Internet Explorer takes it upon itself to popup alt as a tooltip and thus confuse developers everywhere. It's title that was meant always as a means of passing along more information about an element, typically as a tooltip.

login or register to post comments

"image:" prefix in alt text

Submitted by indiechild on November 2, 2002 - 02:15.

I was wondering what you all think of inserting image: immediately before your alt text, e.g. alt="image: a map of Australia indicating the location of Sydney".

I know it seems redundant, but there are some text browsers like lynx that don't appear to differentiate between alt text and regular content, so it's not always obvious to the user that the alt text is in fact, alt text.

login or register to post comments

Re: "image:" prefix in alt text

Submitted by bmason on November 2, 2002 - 08:19.

I think it would be terrible. Envision a screen reader constantly reading "image:" aloud on all the images.

And I can't think of a reason why it would be critical to know that the text is alt text. The alt text is just content, like the rest of the page. If it's written well, it shouldn't stand out from other content anyway, regardless of whether the browser makes it apparent or not.

login or register to post comments

Re: "image:" prefix in alt

Submitted by bertilow on November 3, 2002 - 07:39.

It can make very much sense to state that there is an image available. Not everyone surfing without images is incapable of viewing them. They might just have chosen not to download all images at once. Perhaps they still want to look at some of them. Lynx can download images and hand them over to an image view program. If there is no indication that there even is an image available, some users might miss out on interesting or even important information. Not all images are such that their content can expressed fully with an alt text. Then the alt text can give as much info as is possible, and also say that there is an image available. The user can them decide if he wants to check it out or not.

login or register to post comments

Highlighting images

Submitted by bmason on November 3, 2002 - 10:24.

In my mind, the user has to help themselves if that's what they want. That's part of the charm of the web -- the user gets the last word on how the presentation of the page will look. In Lynx, images can be set to display as links. In mainstream browsers, usually either style sheets or browser preferences will give some method of calling images out.

That's all well and fine if that's what the user wants. It doesn't obligate the developer to break both the alt attribute and the semantics of the web page to try and make an accomodation.

login or register to post comments

Handheld Browser

Submitted by g1smd on November 3, 2002 - 16:01.

On a handheld web browser, such as the XDA, connected by GPRS, you pay for the download per MegaByte. When I use that device I always turn the images off, as all the bullet points and needless graphics account for 75% or more of the band width, and hence 75% of the running cost. However, on a site that uses buttons for navigation, or a forum that has buttons to post a message, or to edit it, then the ALT text becomes absolutely necessary to still make the website at all usable. By using sensible ALT attribute text you are not restricting the way your web site can be used; therefore you are widening your potential audience

login or register to post comments

http://diveintoaccessibility.org

Submitted by sumank on January 22, 2003 - 10:08.

..and you'll realise we are not even scratching the surface. http://diveintoaccessibility.org

login or register to post comments

The access keys for this page are: ALT (Control on a Mac) plus:

evolt.orgEvolt.org is an all-volunteer resource for web developers made up of a discussion list, a browser archive, and member-submitted articles. This article is the property of its author, please do not redistribute or use elsewhere without checking with the author.