Trying to select sibling elements on hover one element. Is there any way to select the elements up the dom tree also? I'm looking for a CSS solution only.
<div id="a">Div A</div>
<div id="b">Div B</div>
<div id="c">Div C</div>
<div id="d">Div D</div>
<style>
#a:hover ~ #b,
#a:hover ~ #c,
#a:hover ~ #d{
background: #ccc
}
#b:hover ~ #a,
#b:hover ~ #c,
#b:hover ~ #d{
background: #ccc
}
#c:hover ~ #a,
#c:hover ~ #b,
#c:hover ~ #d{
background: #ccc
}
#d:hover ~ #a,
#d:hover ~ #b,
#d:hover ~ #c{
background: #ccc
}
</style>