I have a css code that could make the whole page in grayscale.
<style type="text/css">
html {
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
filter: grayscale(100%);
}
</style>
I now want to embed an iframe inside a div that would not be affected. I have searched about the solution and fount :not selector. When I refer to 6.6.7 at http://www.w3.org/TR/css3-selectors/#negation I think i have found the solution because it may work even I put html as my css selector
html|:not(x)
So I changed the code just like the above code but nothing changed. I was worried about the problem is caused by the design of my website so I decided to code them in jsfiddle in the most simple HTML
<div id="abc" class="abc"><font color="red">This should be a normal text.</font></div>
<font color="red">This should be an affected text.</font>
In CSS
html|*:not(.abc) {
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
filter: grayscale(100%); }
Link: http://jsfiddle.net/4vxyqdye/1/
PS: In the previous version I used :not(.abc) only but all elements become grayscale.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…