Alt text is an alternative, not a tooltip
It seems like there is a bit of confusion among many web developers and browser vendors surrounding the use of the alt
attribute to provide alternative text for images and other non-textual elements.
In alt as a tooltip, Anne van Kesteren points to a document on the Channel9 Wiki site that contains feedback about Internet Explorer Programming Bugs. The alt attribute (yes, It’s alt attribute, not alt tag) and how it is displayed by Internet Explorer is discussed in the “Browser Behavior” section. Several people point out that Internet Explorer is wrong in displaying alternative text as a tooltip while also displaying the image.
They are all correct. Unfortunately, judging by the response from one of the IE developers it seems Internet Explorer will continue to display alternative text as a tooltip. But it shouldn’t do that, and most definitely not in a way that is visually similar to how properly specified (by using the title
attribute) supplemental information is displayed.
From the HTML 4.01 Specification chapter 13, Objects, Images, and Applets:
The alt attribute specifies alternate text that is rendered when the image cannot be displayed (see below for information on how to specify alternate text ). User agents must render alternate text when they cannot support images, they cannot support a certain image type or when they are configured not to display images.
I don’t see how this can be interpreted in any other way than “alternative text should never be displayed at the same time as the image it provides an alternative for”. Joe Clark seems to agree:
You get the image or the alt, but not both. It isn’t open to interpretation.
Here are a few of other resources that repeat this message:
- Guidelines on alt texts in img elements: The fundamentals: replacement, not description
- Mozilla Web Author FAQ: Why doesn’t Mozilla display my alt tooltips?
- The alt and title attributes
Some argue that browser vendors should be free to display the alternative text as a tooltip if they want to. I don’t agree. Browsers (with Internet Explorer for Windows being the only one still developed) violating the spec by displaying alternative text as a tooltip has led to widespread misuse of the alt
attribute. If Internet Explorer stopped doing this it would lead to better alternative texts in the long run.
Only use the alt
attribute to specify alternative text. If you want to provide supplemental information that browsers may choose to display as a tooltip, use the title
attribute.
- Previous post: New clearing method needed for IE7?
- Next post: Indicating language choice: flags, text, both, neither?