Title tooltip is not shown when span is child of anchor

后端 未结 2 1575
南笙
南笙 2021-01-21 00:10

For example, consider the following DOM structure.


  

        
相关标签:
2条回答
  • 2021-01-21 00:31

    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;
    }
    
    0 讨论(0)
  • 2021-01-21 00:36

    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.

    0 讨论(0)
提交回复
热议问题