Is there a purely (S)CSS solution to change an unrelated (i.e. not a sibling or a child) div on hover, as I am trying to do in the code below?
.blue,.green {
width: 5rem;
height: 3rem;
margin: 1rem;
}
.blue {
background-color: blue;
}
.green {
background-color: green;
&:hover {
background-color: lightgreen;
}
&:hover .blue {
background-color: lightblue; // trying to effect this change
}
}
<div>
<div class="blue" />
</div>
<div>
<div class="green" />
</div>
Here is the CodePen.
Update: the reply by @alekskorovin is outstanding and deserves many upvotes!