Short question: Why does the background-color of .b does not change when I hover? .a?
CSS
.a {
color: red;
}
.b {
color: orange;
}
.a:hover .b {
background-color: blue;
}
HTML
<div id="wrap">
<div class="a">AAAA</div>
<div class ="b">BBBB</div>
</div>
You need to have
.a:hover + .binstead of.a:hover .b.a:hover .bwould work for a structure likeIf at some point you’ll need to have some elements between .a and .b, then you’ll need to use
.a:hover ~ .b, which works for all siblings of.acoming after it, not just the next one.Demo http://jsfiddle.net/thebabydino/EajKf/