Pete Freitag Pete Freitag

Where are my ALT tooltips in Firefox

Published on March 11, 2005
By Pete Freitag
web

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!



firefox html

Where are my ALT tooltips in Firefox was first published on March 11, 2005.

If you like reading about firefox, or html then you might also like:

Discuss / Follow me on Twitter ↯

Comments

I am pretty sure I saw an extension for that! Unfortunately I can't find it.
by Bill Rawlinson on 03/11/2005 at 5:57:07 PM UTC
As Bill notes, there's a bookmarklet for that -- just create a new bookmark and put this code in the "location" field all on one line):

javascript:(function(){function altToTitle(d){for(var i=0;i<d.images.length;++i)if(d.images[i].title==%22%22)d.images[i].title=d.images[i].alt;}altToTitle(document);for(var f=0;f<parent.frames.length;++f)altToTitle(parent.frames[f].document);})();

This comes from http://nontroppo.org/test/Op7/FAQ/opera-users.html#alt-tooltip, but works in Moz & FF as well.

Once it's there, just click on it whenever you run into an IE-only page, and it'll turn all the ALT text into Titles.

Now if they would just quit truncating text and add a li'l word-wrapping . . . .
by Tracy Logan on 03/11/2005 at 6:19:13 PM UTC
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.
by Barney on 03/11/2005 at 7:13:05 PM UTC
Hey, I just realized that neither Bill nor myself really explained what we were talking about -- which is a very handy hack for FF/Moz/Opera that allows them to show tooltips on pages that incorrectly use ALT text for that purpose (relying on the IE bug/feature).
by Tracy Logan on 03/13/2005 at 9:45:53 PM UTC
Thank you for this, it was helpful :)
by Bryan on 03/29/2005 at 8:40:30 PM UTC
The GreaseMonkey extrension has a quick fix for this:
http://greasemonkey.mozdev.org/

ALT Tooltips for Firefox
http://www.arantius.com/article/arantius/alt+tooltips+for+firefox/
by James Moberg on 05/08/2005 at 3:37:29 PM UTC
This can be fixed pretty easily. Instead of using ALT attribute to display the tooltip for the image, use TITLE. i.e. just replace the 'alt' with 'title'. It would now work well for both Firefox and IE
by Sreejith Kumar on 04/26/2006 at 2:00:28 AM UTC
Sreejith, you wouldn't want to replace the alt with title - you would want to put both the title and the alt text.

Technically the alt text shold provide a brief description of the image as it is used for accessibility (screen readers, etc). If you can't provide a full and useful description of the image in the alt text you should use the longdesc attribute.

Sorry I'm kind of rambling, but my point is you definitly do not want to remove the alt attribute in place of a title attribute. Using both is fine and if you can only use one use the alt.
by Bill Rawlinson on 04/26/2006 at 7:07:33 AM UTC
Yes I agree with Bill - Sreejith you don't want to remove your alt attributes, this will effect screen readers, accessibility, and possibly even search engines.
by Pete Freitag on 04/26/2006 at 8:44:05 AM UTC
Thanks mate for the info! But I have been using only the TITLE attributes so far since I wanted to display the comment on mouse-over in Firefox too. Thanks for this!
by Sreejith Kumar on 05/03/2006 at 11:10:24 PM UTC
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.
by Kelson on 01/29/2007 at 2:01:01 PM UTC
Amazing, its more than 4 years later and the idiots at Firefox haven't gotten their finger out and fixed this shit because of their zealotry. It doesn't matter what the original intention was, now billions of websites and users are using ALT for this. So instead of actually doing what people want, the people behind cripplefox keeps sticking to their outdated notions.
by PJ on 04/06/2008 at 2:47:09 PM UTC
your wrong it is a feature in IE and IE does show the ailt text if image is missing.
by me on 05/24/2008 at 9:42:49 PM UTC
Thanks for this thread. I learnt something new.
by Jasper Levi on 07/28/2008 at 12:06:39 AM UTC
I see your point, thinking the IE treatment of ALT is a convenience. However, you have to have an alt tag in order for your page to validate. But on some pages, if I use some custom tooltip javascript, then I don't want to use a title, because the browser will use it as a tooltip. Since IE says "whatever" and uses the alt tag as a tooltip... it goofs up the special tooltip JS. So, I have to break validation and not include alt tags, just so IE won't mess up my display. If IE stuck to the speck, I could leave out the title attribute, still validate, and be okay.
by Paul Kaiser on 08/13/2008 at 2:04:44 PM UTC
I know this is an old thread, but I decided to google how to fix displaying alt tags in Firefox and came across this page.

I read the entire thread and the best and quickest solution was offered by David, just above. I popped in his little script in my footer and problem solved! No having to alter hundreds of images by adding 'title tag.' Every image on every page displays the alt tag in Firefox now. (Be sure to wrap it with script tags)

Thank you David!
by SFMZone on 07/29/2010 at 5:27:30 AM UTC
Still I have problem in fixing image alt tags, its only displaying in the internet explorer not on Firefox.
by Amy on 11/15/2010 at 6:41:53 AM UTC
I am the creator of Bambote.com the Perfect Homepage, How do i get the alt tag to work for firefox, it works for exsplorer but not firefox, any help???
by nelson on 12/12/2010 at 9:27:49 PM UTC
Nice post thanks for sharing with us .
by ZEEKA INDUSTRIES on 03/21/2011 at 10:09:13 AM UTC