Is there a way to express the CSS3 negation pseudo-class in CSS2?
For example, I have some CSS3 code:
.iMore:not (.__lod ):active {
color: #fff
}
.iMore.__lod {
color: #888
}
I need to somehow express the same thing in CSS2.开发者_StackOverflow I figure it would have to be more verbose, but is it even possible?
This isn't possible. The best you can hope for is to set a default style (.iMore
), and some sort of "active" style (.__lod
). Removing the active style class will "disable" the element.
The problem with CSS2 is that it was never originally meant as a language to perform logic operations as CSS3 lets you do. Instead, it was designed to take what was there and--without much computation--style it based on those directives. Basically, as classes/IDs/etc are added, CSS2 lets you add on descriptors. CSS3 introduces some logic and computational structures (nth-child
, anybody?), so it's technically not fully reversible.
精彩评论