How to distinguish "# id.class" from "# id.class" in SCSS?

How could I make a difference between SCSS:

#id.class { color: red; } 

and:

 #id .class{ color: blue } 

Because I need something like:

 #id { .class { color: red; } ' ' + .class { color: blue; } } 
+6
source share
2 answers

You will need & to reference the parent element of the selector.

Documentation

 #id { .class { color: red; } &.class { color: blue; } } 
+10
source

Use & :

 #id { .class { color: red; } &.class { color: blue; } } 
+5
source

All Articles