There isn’t a CSS parent selector per say. However, you can use the :has()
pseudo-class to find a parent element. Let’s see how!
HTML
Code
<style>
.parent {
background-color: #f5f5f5;
}
.parent:has(.child:hover) {
background-color: #eee;
}
.parent:has(.child:focus) {
background-color: #333;
}
</style>
<div class="parent">
<button class="child">Click this</button>
</div>