Elements A and B are next to each other in the same parent element. Now I want that when I hover over element B, element A is also affected.
.child-a,
.child-b {
height: 200px;
width: 200px;
}
.child-a {
background-color: brown;
}
.child-b {
background-color: blue;
}
.parent .child-b:hover, /* Works */
.parent .child-b:hover + .child-a { /* Doesn't work*/
background-color: black;
}
<div class="parent">
<div class="child-a"> /* should be affected when i hover on element B*/
A
</div>
<div class="child-b">
B
</div>
</div>