I was wondering why Firefox doesn't show tooltips when you use the
alt attribute in
img tags like IE does. Turns out IE should not be displaying alt messages in tooltips, the
title attribute is designed for that.
But don't stop using the
alt attribute, thats required for accessibility. So your best bet is to include both an alt attribute, and a title attribute in your img tags if you want a tooltip. IE will show the title attribute value in the tooltip.
People say that displaying alt text in a tooltip is a bug in IE, but I would rather call it a feature!
I'd say it's a bug. As you say, 'alt' is alternate text for the image. Since IE is displaying the image, the alternate text is irrelevant. If you have image display turned off, then the alt text should be listed where the image would ordinarily be.
Since IE will correctly display the 'title', rather than the 'alt' if both are present, it's a bug that is pretty irrelevant (i.e. if you code it right, IE works right), so I don't know that anyone will complain too much.
This is one of those vague rules: "For user agents that cannot display images, forms, or applets, this attribute specifies alternate text".
I don't read this to mean "you *must not* render this text when an image can be displayed", though I would agree that it doesn't usually make sense to display both, particularly when it is commonly accepted that the title attribute was created for this purpose: "This attribute offers advisory information about the element for which it is set." Note the rest of the comments on the usage of alt and title on that page (and the equivalent in xhtml if you are reading that one too) -- very much worth reading.
This is one of those choices the implementers of IE obviously chose to do one way while creators of other browsers have chosen to implement another (with perhaps a little more 20/20 vision clarity thanks to the passage of time).
Ha. This is great. In my digital media and web design class, my teacher seems to have this hatred of Firefox (even though she admits, she uses it as her web browser at home). Even though tooltips aren't vital, she places a lot of emphasis on them and thus, asks many of us to use the bain of our existence, IE. Of course, Firefox had never been installed on our computers until I made it my duty to put it on every PC I came in contact with. This should put a damper on my teachers Firefox-phobia. It's so nice when smart people publish their solutions online so the rest of us can get through everyday life easier:)
ALT and TITLE serve different purposes. ALT is replacement test. TITLE is supplementary text. Replacement text might be something like, "Picture of our founder, Jane Public, standing in front of a bridge." Supplementary text might be something like, "Our founder, Jane Public." This becomes more noticeable if you have a headline or company logo in graphical form. You should repeat the headline or name in ALT for people using text browsers or with images turned off... but it doesn't serve any purpose to display a tooltip with that information. So in that case, you're best off putting text in ALT and using a blank TITLE.
Writing text for the intended purposes results in a page that works cross-browser and is more accessible than picking one attribute over the other.