Rails 2.3.5(在本地主机上以开发模式运行)
我一直没能找到这个问题的答案。在 IE8 和 FF 中,alts(工具提示)不会在鼠标悬停时出现。然而出于某种原因,在 IE7 中他们这样做了。我猜想这是我缺少的一些基本知识,或者我的样式表中有一些东西正在杀死 IE7/IE8 中的工具提示?我没有使用工具提示脚本或插件。
我使用 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' %>
虽然我很确定这不是 Rails 的东西,因为即使是这个手工编码的 img 标签也不会在 IE8/FF 中显示它在悬停时处于 alt(但在 IE7 中会显示)。
<span id="show_user_panel_arrow"><img src="\images\user_panel_expand.png"
alt="show bulk user panel" id="user_panel_arrow" /></span>
谢谢!
最佳答案
alt
是工具提示的错误属性。旧版本的 IE 不正确地使用鼠标悬停标题的 alt 属性。 alt 是图像未出现时显示的替代文本。
使用 title
属性。
例子:
<img src="mypic.jpg" alt="Description" title="This shows up on mouseover" />
关于html - image_tag(或 html <img>)alt(工具提示)未出现在 IE8 或 FF 中,但出现在 IE7 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5435407/