Is there any way to get the CSS :not() selector wo

2019-01-26 18:56发布

问题:

Anyone know any tricks to use the CSS :not() selector in IE and Chrome?

e.g. this works in Firefox: iframe:not(.anifrmclass){}

Cheers!

回答1:

Specificity is your friend. Apply your :not(.anifrmclass) styles to all <iframe>s then override with other values for <iframe class="anifrmclass">.

iframe {
    /* Styles for all -other- iframes */
    display: none;
}

iframe.anifrmclass {
    /* Override for this class with values other than the above */
    display: inline-block;
}