【问题标题】:Is there a way to make IE8 honour opacity on an `:before` pseudo element?有没有办法让 IE8 在 `:before` 伪元素上保持不透明度?
【发布时间】:2011-11-22 12:59:35
【问题描述】:

我有这个简单的 CSS...

div:before {
    content: "G'day";   
    filter: alpha(opacity=40);
    -moz-opacity: .4;
    opacity: .4;
}

jsFiddle.

:before 伪元素在 Firefox 6 中具有正确的不透明度。在 IE8 中,不应用不透明度。

Typically,在div 上设置不透明度可以,但这不是我想要的。

我尝试添加display: block,但没有帮助。

虽然我可以解决这个问题,但是否有任何技巧可以让 IE8 尊重 :before(以及 :after)伪元素上的 opacity 属性?

【问题讨论】:

  • 我认为这不可能。不久前我遇到了同样的问题,最后我只是解决了它。
  • @thirtydot:感谢您帮我检查。如果您将其发布为答案,我会接受。

标签: css internet-explorer-8 opacity pseudo-element


【解决方案1】:

我认为这是不可能的。

前段时间我遇到了同样的问题,最后我只是解决了这个问题(不使用:before)。

以下是关于为什么不可能的一些合理推理:Why does a filter gradient on a pseudo element not work in IE8?

【讨论】:

    猜你喜欢
    • 2011-09-02
    • 1970-01-01
    • 1970-01-01
    • 2013-11-02
    • 2011-01-28
    • 1970-01-01
    • 1970-01-01
    • 2015-03-09
    • 2013-10-15
    相关资源
    最近更新 更多