我有一个css代码,可以使整个页面灰度.
html {
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
filter: grayscale(100%);
}
我现在想在一个不受影响的div中嵌入一个iframe.我搜索了解决方案和fount:not selector.当我在http://www.w3.org/TR/css3-selectors/#negation参考6.6.7时,我认为我已经找到了解决方案,因为它甚至可以用html作为我的css选择器
html|:not(x)
所以我改变了代码,就像上面的代码一样,但没有改变.我担心这个问题是由我的网站设计造成的,所以我决定用最简单的HTML在jsfiddle中编码它们
This should be a normal text.
This should be an affected text.
在CSS中
html|*:not(.abc) {
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
filter: grayscale(100%); }
链接:http://jsfiddle.net/4vxyqdye/1/
PS:在之前的版本中,我使用了:not(.abc),但所有元素都变成了灰度.