For example I have:
<style>
.a:hover {
color: white;
}
.a {
color: blue;
}
.b {
color: red;
}
</style>
<div class="a">
<div>First</div>
<div class="b">Second</div>
</div>
How do I make both inner divs go color: white while i want them to be different color not on hover? Cant figure it out. It just wont change color of second one, no matter what I try.
They both at the same time should become white, not line by line.
You can use this:
.a:hover .b, .a:hover div {
color: white;
}
.a {
color: blue;
}
.b {
color: red;
}
<div class="a">
<div>First</div>
<div class="b">Second</div>
</div>
or
.a:hover div{
color: white;
}
.a {
color: blue;
}
.b {
color: red;
}
<div class="a">
<div>First</div>
<div class="b">Second</div>
</div>
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