Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 有没有办法欺骗IE7使用伪元素:after和:before?_Css_Pseudo Element - Fatal编程技术网

Css 有没有办法欺骗IE7使用伪元素:after和:before?

Css 有没有办法欺骗IE7使用伪元素:after和:before?,css,pseudo-element,Css,Pseudo Element,我有一个导航栏在我的页脚,这是所有设置和工作在一切,当然,除了在IE7。 我使用:after伪元素在导航栏中的每个后面放置一个管道“|”,但在IE7中,它没有显示。 这不是什么大事,也没那么难看,但我似乎找不到任何东西来支撑它或欺骗IE7使其工作。我自己也没有尝试过 但是我有一段时间的书签了 请查看: 编辑: 确保您也阅读了包含一些有用信息的评论(例如jQuery)否。 自2012年1月3日起,此脚本仅支持IE8上的:before和:after: 截至2012年1月3日,所提及的Selectiv

我有一个导航栏在我的页脚,这是所有设置和工作在一切,当然,除了在IE7。 我使用:after伪元素在导航栏中的每个
  • 后面放置一个管道“|”,但在IE7中,它没有显示。
    这不是什么大事,也没那么难看,但我似乎找不到任何东西来支撑它或欺骗IE7使其工作。

    我自己也没有尝试过

    但是我有一段时间的书签了

    请查看:

    编辑:

    确保您也阅读了包含一些有用信息的评论(例如jQuery)

    否。 自2012年1月3日起,此脚本仅支持IE8上的:before和:after:

    截至2012年1月3日,所提及的Selectivizr没有:before和:after

    截至2012年1月3日,这看起来还没有准备好(尽管可能已经准备好):


    我一直在寻找一种让这些伪元素在IE7上工作的方法,但看起来这是不可能的。

    就我个人而言,我可能会使用jQuery添加一个
    |
    :before
    :after
    。如果您只在这个简单的问题上需要它,那么它可能比整个库要轻量级得多(当然,这只有在您已经在使用jQuery的情况下才有意义)

    $('.element-with-after-class').append('<span class="ie-safe-pseudo-after>|</span>');
    
    $('.element with after class')。追加('|');
    


    $('.element with after-class:not(.element with-after-class:last-child)')。追加('这是您的IE7工作代码:

    HTML

    <ul>
        <li>link</li>
        <li>link</li>
        <li>link</li>
        <li>link</li>
    </ul>​
    
    li {display: inline;}
    li {*zoom: expression( this.runtimeStyle.zoom="1", this.insertBefore( document.createElement("i"), this.firstChild).className="ie-before" );}
    li .ie-before {*zoom: expression(this.runtimeStyle['zoom'] = '1', this.innerHTML = '|');}​
    

    这篇文章解释了如何“在IE7中使用:before和:after”。或者,请查看。加载IE8.js一个,看看它是否有用。我无法确切找到它支持的选择器,因此它可能无法工作。不幸的是,Selectivizer不支持:after和:before-否则它将是一个很棒的脚本。刚刚意识到这个问题有多老了..我是如何来到这里的?为什么?哈哈。。不管怎样,也许有人仍然可以用这个…干杯谢谢你的回答!这里有一个JSFIDLE给任何想看的人…天哪,马兹列托夫。
    <ul>
        <li>link</li>
        <li>link</li>
        <li>link</li>
        <li>link</li>
    </ul>​
    
    li {display: inline;}
    li {*zoom: expression( this.runtimeStyle.zoom="1", this.insertBefore( document.createElement("i"), this.firstChild).className="ie-before" );}
    li .ie-before {*zoom: expression(this.runtimeStyle['zoom'] = '1', this.innerHTML = '|');}​