Here's a fairly simple jsfiddle. When I over over the blue square, the blue square's CSS hover state triggers (causing it to turn white). When I hover over the red square, the same thing happens with the red square.
What I want is when I hover over the overlap, that I trigger the hover states on both the red and blue square. Is this possible?
Specifically, can I indicate somehow that a hover state should trigger, but that it should also pass through to any element behind it?
Additionally, I'd like to do this in pure CSS. I'm sure it can be done with JS.
(The real code is more complicated, of course.)
Here's the full code:
HTML:
<div class="a">
<div class="b">
b
</div>
<div class="c">
c
</div>
</div>
CSS:
.a {
position: relative;
}
.b {
width: 40px;
height: 40px;
top: 5px;
left: 5px;
position: absolute;
background-color: blue;
}
.b:hover {
background-color: white;
}
.c {
width: 40px;
height: 40px;
top: 25px;
left: 25px;
position: absolute;
background-color:red;
}
.c:hover {
background-color: white;
}