-2

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/

0

2 Answers 2

13

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

3
  • 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? Commented Dec 6, 2011 at 6:15
  • 5
    @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 Commented Dec 6, 2011 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
    Commented Dec 6, 2011 at 8:01
9

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)

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