[pmwiki-users] Note on tooltip options

Allister Jenks arj at zkarj.co.nz
Fri Mar 17 18:37:35 CST 2006


On 3/18/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
>
> ... is it important to make a distinction between alt= and title= in
> images?


The HTML spec says alt= is mandatory and should be used in place of the
image when the image cannot be displayed or the user has chosen not to
display images.

The title= attribute is optional and should be used to describe "advisory
information about the element for which it is set"

If I was to get pedantic about this I would say they should be used like
this:

<img src="pmwikilogo.gif" alt="PmWiki logo" title="This site is powered by
PmWiki"/>

The alt value should describe the image and the title attribute should
describe the reason why the image is there.  The obvious one to use for a
tooltip is the title attribute and this is consistent with other elements.

However, the alt attribute is *mandatory* and some browsers render as a
tooltip anyway.

I just did a test of an image with both attributes.  With image unavailable,
both Firefox 1.5 and IE6 show an image placeholder with 'broken image' icon
and the alternate text within the frame. There is a tooltip with the title
text.  With the image available, both display the image and use the title
text for the tooltip.

Remove the optional title attribute and the behaviours differ.  Firefox does
not have a tooltip, IE6 uses the alt text for a tooltip.  This suggests that
if the intent is a tooltip, then the title attribute should be used.

So the only remaining question is do we need to offer both alt and title as
distinct values?  From a purist's point of view, yes.  Pragmatically?  Don't
know.

--
Allister
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-users/attachments/20060318/098f3d24/attachment.html 


More information about the pmwiki-users mailing list