JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div class="hover">Hover over me. Change my parent.</div>
<div class="overlay"></div>
</div>
CSS
.container {
background: lavender;
position: relative;
width: 600px;
height: 400px;
border: 1px solid black;
}
.overlay {
width:100%;
height:100%;
}
.hover {
background: lightblue;
width: 200px;
height: 200px;
position: absolute;
left: 0;
top: 0;
}
.hover:hover ~ .overlay {
background: seagreen;
}
JavaScript
//Faking parent selector behavior using pure CSS