Is there anyway to style the previous/prior sibling elements using only css?
I want to style 4 siblings so that when I hover over one of them the opacity of other 3 siblings changes (dim out) [+ ~] these combinator selectors only applies on the followed/ next / coming siblings not for the previous/prior ones .. so the style applies only on the first sibling as there's no other siblings come before it..but don't apply for the rest siblings! Here's the code I was working on : https://code.sololearn.com/WZcNM90uJoIa/?ref=app Here's the part I'm referring to: .bar1:hover + .bar2, .bar1:hover ~ .bar3, .bar1:hover ~ .bar4{ opacity: 0.3; } .bar2:hover ~ .bar1, .bar2:hover + .bar3, .bar2:hover ~ .bar4{ opacity: 0.3; } .bar3:hover ~ .bar1, .bar3:hover ~ .bar2, .bar3:hover + .bar4{ opacity: 0.3; } .bar4:hover ~ .bar1, .bar4:hover ~ .bar2, .bar4:hover ~ .bar3{ opacity: 0.3; }