Home > Back-end >  How to apply css to self AND sibling element?
How to apply css to self AND sibling element?

Time:11-01

so I know how to apply css (obvs) and also how to apply to sibling:

This will apply to #myId ONLY. how do I apply to the hover on (self) AND #myId

&:hover ~ #myId {...}

this seems to just apply to #myId and hover on self doesn't actually do anything

CodePudding user response:

I guess & is from Sass, If you want to apply your style to the hovered element and when it's hovered, to it's #mydId sibling, you can use

&:hover, &:hover ~ #myId {...}
  • Related