An Unfinished Symphony

It's about the internet and stuff.

longdesc, it's not just alternate text

Most developers are, I would hope, aware of alt attributes, and hopefully how to use them correctly. It seems, however, that longdesc is a bit of a mystery even to some of the more experienced and knowledgeable amongst us.

With an image's alt attribute we're able to insert a small segment of text that provides an alternative if, for whatever reason, the image is unable to be displayed. It may be something simple, such as "my company logo" to replace your logo when it doesn't open up. With more complex images, and images that convey very important information such as charts and diagrams, a more detailed description is required – not in case the image doesn't display, but to provide an alternative means of providing the detailed information the image contains. In this case the alt attribute just isn't enough. It isn't viable to describe a graph of medical results, for example, in the few words that alt attributes allow us. For circumstances such as in our medical chart example we have been provided a more powerful method with the longdesc attribute. However, due to the mysterious nature of longdesc it seems that many of us are incorrectly using it in the same way as we use alt attributes. To illustrate the point, consider the markup for an embedded image with alt attribute:

  1. <img src="image.gif" alt="my company logo" />

As the above example shows, alt attributes contain our alternative text enclosed between quotation marks and within our image tag. Longdesc attributes, however, don't enclose the long description within the confines of its quotation marks, instead longdesc contains a link to another web page where we would describe in detail the image in question. Nor would our longdesc attribute be used to replace our alt attribute – instead we would use both; for example:

  1. <img src="compleximage.gif" alt="Results graph of medical data" longdesc="/clinicalresults.html" />

Rather than being a more detailed, and direct, replacement for alt attributes the longdesc attribute, and associated descriptive web page, is intended to be used in conjunction with alts in order to enable us to provide our visitors with as much information as they might require about the imagery used.

Up arrow

Comments on 'longdesc, it's not just alternate text'

RSS feed for comments on this post.

gravatar

[…] Unfinished Symphony – some very nice posts about css, xhtml and accessibility. In particular a very good post about the oft misunderstood Longdesc […]

gravatar
Graham says:

Great but what about a d-link to go with the longdesc?

gravatar

Hi Graham, thanks for the comment. The post is specifically about longdesc and how to use that, and not alternatives. But if there's interest in a follow up covering D links then I can write a post on those too.

Cheers!

Sorry, the comment form is closed at this time.