What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 133 Stack Exchange communities.

Possible Duplicate:
Also use alt tag as title on images

Alt text does not produce tooltips on Chrome (and maybe other standard compliant browsers).

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. (HTML 4.01 Spec, 13.2)

The standard compliant browser will display only the image, or when that is not possible, only the alt text.


I propose using:

<img title="This is a tooltip." />

Instead of, or in addition to:

<img alt="This is NOT a tooltip." />

EDIT: I am not sure, but I don't think alt is valid HTML5.


References

http://www.456bereastreet.com/archive/200604/alt_text_is_an_alternative_not_a_tooltip/
http://www.paciellogroup.com/blog/2011/04/html5-accessibility-chops-the-alt-decision/

share|improve this question

marked as duplicate by Arjan, Shadow Wizard, Pops, kiamlaluno, tvanfosson Dec 6 '11 at 19:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

up vote 11 down vote accepted

Markdown actually supports both. This:

![Foo](http://sstatic.net/stackoverflow/img/logo.png "Bar")

Turns into this:

<img src="http://sstatic.net/stackoverflow/img/logo.png" alt="Foo" title="Bar">

And looks like this:

Foo

share|improve this answer
    
Then shouldn't the image button produce ![Enter description here](http://example.com/example.jpg "") so that users can realize that they can add title text? –  muntoo Dec 6 '11 at 6:15
4  
@muntoo I suppose, but I doubt it would get used much; it's incredible how many images still have "Enter description here" as the alt text –  Michael Mrozek Dec 6 '11 at 6:21
1  
@muntoo, no. The alt text is there for those who cannot see the image. Most often, that text should be different from its title. –  Arjan Dec 6 '11 at 8:01

Alt text does not produce tooltips on Chrome (and maybe other standard compliant browsers).

And what is the problem? This is how its spelt out in the specifications. alt is alternative, where you provide a text alternative to the pictorial content you're trying to display for users who cannot view the image. The distinction between title and alt is clear. If the user was confused, expecting what he typed in as the alt text to appear as title text, then we may have a problem with the user interface. But I presume this is not what you're asking for.


EDIT: I am not sure, but I don't think alt is valid HTML5.

Huh?

Except where otherwise specified, the alt attribute must be specified and its value must not be empty

A corollary to this is that the alt attribute's value should never contain text that could be considered the image's caption, title, or legend. It is supposed to contain replacement text that could be used by users instead of the image; it is not meant to supplement the image. The title attribute can be used for supplemental information.

HTML5 specification edition for web developers

(Emphasis mine)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged .