0
Well, here’s my problem:
I have five buttons, in horizontal order. Each one has a specific color in the Hover. When placing the mouse over any of them, all the others should take over the color the selected has.
I was able to use this effect successfully on the first button, since the others changed color; when applying the code to the others, only the buttons in front (right) changed color, and I can’t get the previous button to change.
To demonstrate, I’ll simulate the third button, call it "box3". I’m trying the following:
box3:hover ~ box1 {
background-color:red;
}
box3:hover ~ box2 {
background-color:red;
}
^ the two above are the ones on the left and don’t change color
box3:hover ~ box4 {
background-color:red;
}
box3:hover ~ box5 {
background-color:red;
}
Obs: I didn’t put box3 to change color because this is another element’s Hover, so unnecessary.
I have tried to replace ~ by +, > and empty space as well. Thanks!!
Not only will you get it with CSS, because the available selectors only see the elements ahead of the question. To do this I believe you will need Javascript.
– Woss
@Andersoncarloswoss I don’t know if it gets boring/complicated the way I did, but it was possible with
pointer-events
:)– Guilherme Nascimento