C.Ronaldo C.Ronaldo - 4 months ago 7
CSS Question

Change css from sibling when hovered on with SCSS

I want to change the css from the sibling when I hover on the element. Is there a way to do this with SCSS?

Example: https://jsfiddle.net/rqb5ytav/

Like when I hover on

.one
how do I change the background color of
.two
?

Answer

Use + CSS selector. It's available from CSS2.

.one:hover + .two {
    background-color:green;
}

Please look at the fiddle: https://jsfiddle.net/rqb5ytav/1/.