Title tooltip is not shown when span is child of anchor

瘦欲@ 提交于 2019-12-01 22:18:14

Even though the span which is a child of anchor has some minimum height because of the text it holds, the anchor as such doesn't has any height in IE. Because of this, whenever you hover over the text, the tooltip doesn't appear. To verify the same, execute the following code snippet in console

document.getElementById("element's id").offsetHeight // will return 0

This is a bug in IE and workaround would be to do something like following:

a[title] span {
    display: inline-block;
}

Just a little mentioning of an IE mystery I just had in this context (IE9 in IE7-mode). My links with title-Tooltips have nested divs in it, and the tooltips show - but not if below there is a spacer-div with "clear:both" in its definition. After I removed the clear from the spacer, the tooltips showed. Before, they did not show in the row above the spacer, but they worked below the spacer. Yeah. Some more hours of experimenting to find an IE workaround.

Of course, a spacer without clear:both does not work very well (FF put it on top of other content above..). Finally it helped to put the title-atts to the inner div instead of the link itself.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!