How to style the parent element when hovering a child element?

前端 未结 8 2359
灰色年华
灰色年华 2020-11-22 05:57

I know that there does not exist a CSS parent selector, but is it possible to style a parenting element when hovering a child element without such a selector?

To giv

8条回答
  •  时光说笑
    2020-11-22 06:18

    This is extremely easy to do in Sass! Don't delve into JavaScript for this. The & selector in sass does exactly this.

    http://thesassway.com/intermediate/referencing-parent-selectors-using-ampersand

提交回复
热议问题