I have two nested div
's
<div class="parent">
<div class="child"></div>
</div>
I want to change the background
from .parent
when I hover over .parent
.
I want the background
to turn normal again when I hover over .child
.
For example, when I hover over the inner area I want the outer area to return to its original (gray) state:
.parent {
width: 100px;
height: 100px;
padding: 50px;
background: lightgray;
}
.parent:hover {
background: lightblue;
}
.child {
height: 100px;
width: 100px;
background: darkgray;
}
.child:hover {
background: lightblue;
}
<div class="parent">
<div class="child"></div>
</div>
I would like to keep this <div>
structure and I do not want a JavaScript solution (I know the JavaScript solution but I want to keep it pure CSS).
This is not a duplicate of "how to style the parent when hovering over a child". I want to NOT style the parent when hovering over a child.