Encountered an issue while working with HTML and CSS:
//HTML
<div>
<div class="sibling-hover">hover over me</div>
</div>
<div class="parent">
<div>should disappear</div>
</div>
//CSS
.sibling-hover:hover .parent {
display:none;
}
Despite the code snippet, the "parent" div doesn't disappear when hovering over the "sibling-hover" child. The attempted solutions like .sibling-hover:hover ~ .parent
, .sibling-hover:hover + .parent
, and
.sibling-hover:hover > .parent
didn't work as intended. Curious if there's a reason for this limitation, and considering using JavaScript instead.