背景
我使用伪元素:before
和:after
创建了一个纯CSS的工具提示,用于箭头。
在Chrome 16到Firefox 9和10之间,渲染效果不同。
您看出有什么问题了吗?
Chrome截图
火狐浏览器截图
演示
http://jsfiddle.net/wDff8/ 重现了相同的问题。
代码
html:
<span class="tooltip">Déposez votre fichier dans ce dossier</span>
css:
span.tooltip {
display: inline-block;
background: #eee;
margin-left: 20px;
padding: 0 10px;
color: #111;
border-radius: 2px;
border-top: 1px solid #bbb;
border-right: 1px solid #bbb;
border-bottom: 1px solid #bbb;
line-height: 1.5;
position: relative;
}
span.tooltip:before {
content:"";
position: absolute;
width: 0;
height: 0;
border-style: solid;
border-width: 10px;
border-color: transparent #eee transparent transparent;
left: -18px;
top: -1px;
z-index: 1;
}
span.tooltip:after {
content:"";
position: absolute;
width: 0;
height: 0;
border-style: solid;
border-width: 11px;
border-color: transparent #bbb transparent transparent;
left: -21px;
top: -2px;
z-index: 0;
}
body {
font-family: Georgia;
font-size: 12px;
letter-spacing: 1px;
}
border-width
的值,可以让它变粗一些。你在Firefox中没有放大页面吧?放大似乎会导致你在Firefox截图中看到的效果。 - Paul D. Waite