Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

image_tag (or html <img>) alt's (tooltips) not appearing in IE8 or FF, but do appear in IE7?

Rails 2.3.5 (Running in Development Mode on localhost)

I haven't been able to find an answer for this. In IE8 and FF, the alts (tooltips) do not appear on mouseover. Yet for some reason in IE7 they do. I'd guess this is some basic knowledge I'm missing or there's something in my stylesheets that's killing the tooltips in IE7/IE8? I'm not using a tooltip script or plugin.

The two main ways I'm using image_tags:

<%= image_tag("show_group.png", :size => "64x64", :alt => "Show Group") %>

<%=link_to image_tag ("menu_icon_make_new_item.png", :size => "38x27", :alt => 
"Make new item",  :id => 'item_select_menu', :class => 'nothing2'), {},
:onclick =>'dialog_back_to_new_item_select_menu(); return false' %>

Although I'm pretty sure it's not a Rails thing because even this hand coded img tag doesn't show it's alt on hover in IE8/FF (but does show it in IE7).

<span id="show_user_panel_arrow"><img src="\images\user_panel_expand.png" 
 alt="show bulk user panel" id="user_panel_arrow" /></span>

Thanks!

like image 412
Reno Avatar asked Mar 25 '11 16:03

Reno


2 Answers

alt is the wrong attribute for tooltips. Old versions of IE improperly used the alt attribute for mouseover titles. alt is the alternative text that gets displayed if the image does not come up.

Use the title attribute.

example:

<img src="mypic.jpg" alt="Description" title="This shows up on mouseover" />
like image 194
kylex Avatar answered Oct 21 '22 10:10

kylex


Use title option to display text in rails 3.

<%= image_tag 'show_group.png',:title => 'show_group'  %>

When mouse hover over the show_group.png , it will show the text "show_group".

like image 33
Thaha kp Avatar answered Oct 21 '22 11:10

Thaha kp