Skip to content

Instantly share code, notes, and snippets.

@justinryder
Created March 13, 2015 19:34
Show Gist options
  • Save justinryder/a2321f9411e7e03864d1 to your computer and use it in GitHub Desktop.
Save justinryder/a2321f9411e7e03864d1 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
// Can we increase specificity without typing the class name twice?
// e.g .foo.foo {}
.foo {
// Nope, we just get .foo {}
& {
color: red;
}
}
.foo {
// Not quite, we get .foo .foo {}
& & {
color: red;
}
}
.foo {
// && gives an error, so use interpolation
// 3 classes? We get .foo .foo.foo {}
#{&}#{&} {
color: red;
}
}
.foo {
// Back to 2 classes again. We get .foo .foo {}
#{&} {
color: red;
}
}
.foo {
// Success! Increased specificity to duplicate the class name w/o actually typing it twice!
// ...this is kinda ungly though.
&#{&} {
color: red;
}
}
.foo {
color: red;
}
.foo .foo {
color: red;
}
.foo .foo.foo {
color: red;
}
.foo .foo {
color: red;
}
.foo.foo {
color: red;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment