开发者

CSS :not workaround for Internet Explorer

The following example works in Firefox 4, but not in Internet Explorer 8:

HTML:

<div class='first'>A</div>
<div>B</div>
<div>C</d开发者_高级运维iv>

CSS:

div:not(.first) {
    color: red;
}

What workaround would you suggest to make it work in both browsers ?


Why can't you do this?:

div {
    color: red;
}
div.first {
    color: inherit;/* or whatever color you want*/
}

It isn't really a :not() workaround, but it works for your example as far as I can tell. If you didn't have the class you could always use :first-child as well.

Demo


Not perfect but works:

div {
   color: red;
}

div.first {
   //some other colour
}

EDIT: Or what madmartigan said

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜