Firefox中的CSS工具提示悬停位置问题

时间:2013-01-28 19:59:01

标签: css firefox hover position tooltip

我找到了一个完整的CSS工具提示,可以在新网站中使用。它在Safari和Chrome中完美运行。但只有在Firefox中,无论链接在页面的哪个位置,工具提示都会一直悬停在DIV的最左侧。

我在这个网站上发现这个问题非常接近,但没有给我我需要的答案。 CSS Tooltip hovering position issue

它可能是Firefox中的错误,还是我需要为Firefox专门添加其他代码?

我确实根据设置的规则确保相对和绝对定位是正确的。我对这一切仍然很新。所以任何帮助都会受到赞赏。

谢谢。

这是我的代码:

a.tip2 {
position: relative;
text-decoration: none;
}

a.tip2 span {display: none;}

a.tip2:hover span {
display: block;
position: absolute; 
padding: .5em;
content: attr(title);
min-width: 120px;
text-align: center;
width: auto;
height: auto;
white-space: nowrap;
top: -32px;
background: rgba(0,0,0,.8);
-moz-border-radius:10px;
-webkit-border-radius:10px;
border-radius:10px;    
color: #fff;
font-size: .86em;
}

a.tip2:hover span:after {
position: absolute;
display: block;
content: "";  
border-color: rgba(0,0,0,.8) transparent transparent transparent;
border-style: solid;
border-width: 10px;
height:0;
width:0;
position:absolute;
bottom: -20px;
left:1em;
}

1 个答案:

答案 0 :(得分:0)

我遇到类似的问题,Firefox将悬停图像放在与IE,Chrome和Safari不同的位置。

我专门针对Firefox更改了css:

/*Firefox*/
@-moz-document url-prefix()
{
a.enlarge:hover span{top: 250px; left: 20px;}
}

而对于其他浏览器我使用top:-200px