Skip to content

Instantly share code, notes, and snippets.

@lmartins
Forked from barneycarroll/increase-specificity.scss
Last active August 29, 2015 14:10
Show Gist options
  • Save lmartins/d2b1414abfb2bd469c9a to your computer and use it in GitHub Desktop.
Save lmartins/d2b1414abfb2bd469c9a to your computer and use it in GitHub Desktop.
Increase selector specificity
// Increase class-level specificity of a rule without functionaly modifying the selector
@mixin increase-specificity( $depth: 1 ) {
$sel : '';
@while($depth > 0) {
$sel : $sel + ':nth-child(n)';
$depth : $depth - 1;
}
&#{$sel} {
@content;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment