CSS多个伪类和伪元素

时间:2017-08-28 20:03:53

标签: css pseudo-element pseudo-class

这种CSS语法是否存在并且可以安全地用于所有现代浏览器。

footer ul.footer-menu li:not(:first-child):after

2 个答案:

答案 0 :(得分:1)

是的有效,请参阅下面的代码段。



footer ul.footer-menu li:not(:first-child):after {
    content: 'added some text';
    color: red;
}

<footer>
    <ul class="footer-menu">
        <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ut tempora voluptatum praesentium rem culpa, cupiditate quas animi commodi voluptates? Cupiditate error cum suscipit dolorum deleniti? Non dolore, cumque assumenda voluptatum.</li>
        <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ut tempora voluptatum praesentium rem culpa, cupiditate quas animi commodi voluptates? Cupiditate error cum suscipit dolorum deleniti? Non dolore, cumque assumenda voluptatum.</li>
        <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ut tempora voluptatum praesentium rem culpa, cupiditate quas animi commodi voluptates? Cupiditate error cum suscipit dolorum deleniti? Non dolore, cumque assumenda voluptatum.</li>
        <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ut tempora voluptatum praesentium rem culpa, cupiditate quas animi commodi voluptates? Cupiditate error cum suscipit dolorum deleniti? Non dolore, cumque assumenda voluptatum.</li>
    </ul>
</footer>
&#13;
&#13;
&#13;

是的,在所有现代浏览器上使用都是安全的。根据caniuse.com的数据,updated that Wikipedia CORS article:after),generated content by pseudo-elements:first-child)和CSS 2.1 selectors(全球支持率接近98%)( :not)。

答案 1 :(得分:1)

:not 97.72%全球浏览器支持

:first-child 97.74%全球浏览器支持

:after 97.72%全球浏览器支持

  

您可以随时了解是否可以使用......这里

     

参考:https://caniuse.com/