.wrapper { width: 10px; &_item { &:hover { width: 20px; .wrapper_button { ???? color: black; } } } } 

Is it .wrapper_button use an ampersand instead of .wrapper_button ?

  • So what do you want to get at the output? - MihailPw
  • Is this sass or is it less the syntax in the example?))) - Air
  • @Air is the scss syntax with the sass compiler, as I understand it. Announcement of at least one variable would be accurate. - MihailPw
  • scss, I wrote - Agni Kai

2 answers 2

By simple - no. You cannot select a level with an ampersand. But you can use variables:

 .wrapper { $ws: &; // wrapper selector width: 10px; &_item { &:hover { width: 20px; #{$ws}_button { color: black; } } } } 

    You can, the result is then

     .wrapper { width: 10px; } .wrapper_item:hover { width: 20px; } .wrapper_item:hover { color: black; }