I am able to target the "next" siblings using the ~ operator, but the previous sibling are not being targeted.
In the fiddle bellow, if you hover Menu items 1, 2 and 3 then the red font is removed. However if you then hover menu items 4 and 5 then the red font is visible. Is it possible with CSS to hide the red font no mater which menu item is hovered? I thought the sibling ~ selector would work for this but it seems to only target the next siblings.
HTML:
<ul>
<li class="sub-menu">Active Menu 1</li>
<li class="sub-menu">Active Menu 2</li>
<li class="sub-menu active-menu">Active Menu 3</li>
<li class="sub-menu">Active Menu 4</li>
<li class="sub-menu">Active Menu 5</li>
</ul>
CSS:
.sub-menu {
color: #000;
}
.active-menu {
color: red;
}
.hover {
color: pink;
}
.hover ~ .sub-menu {
color: #000;
}