Skip to content

Instantly share code, notes, and snippets.

@barneycarroll
Created April 3, 2014 18:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save barneycarroll/9959522 to your computer and use it in GitHub Desktop.
Save barneycarroll/9959522 to your computer and use it in GitHub Desktop.
Generic mixin to increase the specificity of the contents rules
// 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