Christoph's answer is perfect. Sometimes however you may want to go more classes up than one. In this case you could try the @at-root
and #{}
css features which would enable two root classes to sit next to each other using &
.
This wouldn't work (due to the nothing before &
rule):
container {_x000D_
background:red;_x000D_
color:white;_x000D_
_x000D_
.desc& {_x000D_
background: blue;_x000D_
}_x000D_
_x000D_
.hello {_x000D_
padding-left:50px;_x000D_
}_x000D_
}
_x000D_
But this would (using @at-root plus #{&}
):
container {_x000D_
background:red;_x000D_
color:white;_x000D_
_x000D_
@at-root .desc#{&} {_x000D_
background: blue;_x000D_
}_x000D_
_x000D_
.hello {_x000D_
padding-left:50px;_x000D_
}_x000D_
}
_x000D_