【发布时间】:2011-10-28 16:56:35
【问题描述】:
我开始使用 :before 伪元素在列表中的锚文本之前显示徽标。
我已按照 Nicolas Gallagher 的说明进行操作,但背景图像未在 IE8 中显示。在其他浏览器中工作。有人看到我可能做错了什么吗?
我在此处发布了示例: http://vervedesignstudios.com/gb/testBefore.html
这里是标记: 提前感谢您的建议。
<style>
/* Pseudo-element cropping bit */
.iLst24 li a:before {
content:"";
float:left;
width:24px;
height:24px;
margin:0 6px 0 0;
background-image:url("images/HomeSprite.png");
}
.iLst24 .fb a:before {background-position:0 0;}
.iLst24 .tw a:before {background-position:0 -50px;}
.iLst24 .yt a:before {background-position:0 -100px;}
</style>
<div class="iLst24">
<ul>
<li class="fb"><a href="http://www.facebook.com">Facebook</a></li>
<li class="tw"><a href="http://www.facebook.com">Twitter</a></li>
<li class="yt"><a href="http://www.facebook.com">YouTube</a></li>
</ul>
</div>
【问题讨论】:
-
它在 IE8、你的演示和this one...中对我来说完全正常。
-
谢谢韦斯利。 IE 也被设置为兼容模式,我没有注意到。
标签: css internet-explorer-8 background-image pseudo-element