I'm trying to transition the opacity of 2 background images in 2 separate divs while hovering over a 3rd using HTML and CSS. Seems fairly straight forward but I have had no luck searching everything I can on hover targets including not:hover, parents siblings etc. Here is a link to my codepen example. My goal is to affect the opacity of box 1 & 2 by only hovering box 3 (blue box) and reverting back on hover out. All suggestions on restructuring and/or styling are welcome. Thanks.
https://codepen.io/NikoVanDam/pen/Ygzjpz
HTML
<body>
<div class="Container">
<div class="Box1"></div>
<div class="Filler1"></div>
<div class="Box2"></div>
<div class="Filler2"></div>
<div class="Box3"></div>
</div>
</body>
CSS
.Container {
width: 383px;
height: 404px;
background: yellow;
float: left;
}
.Box1 {
width: 383px;
height: 210px;
background: red;
float: left;
opacity: 0.2;
transition: opacity 0.5s ease-in-out;
-webkit-transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
-ms-transition: opacity 0.5s ease-in-out;
}
.Filler1 {
width: 130px;
height: 194px;
background: grey;
float: left;
}
.Box2 {
width: 253px;
height: 110px;
background: blue;
float: left;
Opacity: 0.2;
transition: opacity 0.5s ease-in-out;
-webkit-transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
-ms-transition: opacity 0.5s ease-in-out;
}
.Filler2 {
width: 160px;
height: 84px;
background: grey;
float: left;
}
.Box3 {
width: 93px;
height: 84px;
background: blue;
float: left;
}