Html 锚点标题的工具提示未在 IE9 中显示
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6822929/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Tooltip on anchor's title not shown in IE9
提问by Maor Barazany
Has something was changed in the way IE9 treats the titleattribute in an anchor tag? I try to use a regular anchor, such as -
IE9 处理锚标记中的标题属性的方式是否发生了变化?我尝试使用常规锚点,例如 -
<a href="http://www.somelink.com" title="Some title here">This is a link</a>
A tooltip should be with the title is expected to appear, and it does appear in previous versions of IE and also in other browsers, but not on IE9. Is there a know issue with that? I tried to search the web for that, but found nothing about this. Any ideas? Thanks
工具提示应该与标题一起出现,它确实出现在以前版本的 IE 和其他浏览器中,但不会出现在 IE9 上。这有什么问题吗?我试图在网上搜索它,但一无所获。有任何想法吗?谢谢
采纳答案by jamierushad
The code for the href link above works fine in IE9. Which leads me to believe something else on the page is causing the issue. Have you tried validating your html? http://validator.w3.org/
上面 href 链接的代码在 IE9 中工作正常。这让我相信页面上的其他东西导致了这个问题。您是否尝试过验证您的 html?http://validator.w3.org/
It could be that there's something else broken that the other browsers are just looking past. Perhaps it's nested in such a way that's causing IE9 to overlook the tag.
可能是其他浏览器刚刚忽略了其他问题。也许它的嵌套方式会导致 IE9 忽略标签。
回答by Chris Spittles
I have encountered this problem in a few applications I've worked on.
我在我处理过的一些应用程序中遇到过这个问题。
I've found it doesn't work if you have nested elements within the element with the title.
我发现如果您在具有标题的元素中嵌套了元素,它就不起作用。
The example below doesn't show its title in IE9 for me:
下面的示例没有在 IE9 中显示它的标题:
<a href="test.html" title="test tooltip"><span>test link</span></a>
However, this example does work:
但是,这个例子确实有效:
<a href="test.html" title="test tooltip">test link</a>
That is with an XHTML 1.0 Transitional doctype and Browser Mode: IE9 and Document Mode: IE9 Standards.
那就是 XHTML 1.0 Transitional doctype 和浏览器模式:IE9 和文档模式:IE9 标准。
Obviously your example doesn't have a nested element but thought it might be relevant to some people who find this post based on the title.
显然,您的示例没有嵌套元素,但认为它可能与根据标题找到这篇文章的某些人相关。
You can overcome this limitation in IE by specifying the nested element to be an inline-block:
您可以通过将嵌套元素指定为内联块来克服 IE 中的此限制:
a span {
display: inline-block;
}
回答by Kathleen
I have found a good work-around, Place your title in an abbr tag. I've tested this in Safari, Chrome, IE9, and Firefox. It works in all of them.
我找到了一个很好的解决方法,将您的标题放在 abbr 标签中。我已经在 Safari、Chrome、IE9 和 Firefox 中对此进行了测试。它适用于所有这些。
回答by Avik
I had a typical scenario wherein we had to show a image with tooltip. The image was inside a Iframe and tooltips were not being displayed, when opened in a Browser with IE 10 Compat Mode.
我有一个典型的场景,我们必须显示带有工具提示的图像。在使用 IE 10 兼容模式的浏览器中打开时,图像位于 Iframe 内,工具提示未显示。
The alt tag helped me out. The solution was to set the images alt tag.
alt 标签帮助了我。解决方案是设置图像 alt 标签。
<A onclick=navigate() title="Did not work" href="javascript:void(0);" height="" width="">
<IMG alt="This worked" src="http://img.webmd.com/dtmcms/live/webmd/consumer_assets/site_images/icons/imageviewer_back_button.gif">
</A>
回答by l33t
A workaround is to put at least one character outside the inner tags:
一种解决方法是将至少一个字符放在内部标签之外:
<a href="#" title="Tooltip"><font color="blue">This does not work</font></a>
<a href="#" title="Tooltip"><font color="blue">This</font> <font color="blue">does work</font></a>