So I got into a problem, I tried the following code in 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;
}
When I hover over the "sibling-hover" child, the "parent" div should disappear. It doesn't seem to work and I don't have any idea why.
I tried .sibling-hover:hover ~ .parent
, .sibling-hover:hover + .parent
and .sibling-hover:hover > .parent
and none of them seem to work. Is there any reason I can't do it, and if so, can I do it in JavaScript instead?