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
精彩评论