【问题标题】:css :before Pseudo-element not displaying background-image with IE8css:在伪元素不使用 IE8 显示背景图像之前
【发布时间】: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


【解决方案1】:

IE8 在标签上的浮动和特定宽度/高度值方面存在多个问题。尝试添加“zoom:1”来触发 haslayout,看看是否有帮助。

【讨论】:

  • 天哪,你为什么还在 IE8 中工作,你这个可怜的东西 @adaam
猜你喜欢
  • 2017-10-24
  • 2021-08-07
  • 2020-02-02
  • 2012-08-01
  • 1970-01-01
  • 1970-01-01
  • 2021-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多