Is there very better one line crossbrowser solution to change children text colour via css?
Need to make all text red on hover div
html:
<div><span class="gray">I'm a lion!</span><span>Arrrrr!!!</span></div>
css:
div {color:black};
.gray {color:gray;}
div:hover {color:red;}
I thought only this
div:hover, div:hover .gray {color:red;}
your own...
div:hover, div:hover .gray {color:red;}
...is as good a solution as any, really. If you want to match other classes/elements as well you can use a star;
div:hover, div:hover * { color:red; }
demo at http://jsfiddle.net/h5BaU/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With