I am coming from the .NET world and need an advice for a CSS styling:
We implemented a system which lets us design UI widgets with any SVG editor. For example a simpe play button would have a background rectangle and a triangle. In this widget all elements except the background have pointer-events="none"
, so that the background receives all mouse events. But on hover over the background we want to style all foreground elements as well.
Suppose there are classes .a
and .b
and all elements are on the same level. To modify .a
on hover you write:
.a:hover { stroke: red }
To modify .b
when hovered over .a
you write:
.a:hover ~ .b { stroke: red }
But how can i do both at once? Of course one can write both statements, but what when there is another class .c
? Would it need its own statement as well or is there something like:
//fantasy code
.a:hover ~ (.a + .b + .c) { stroke: red }