Skip to content

Instantly share code, notes, and snippets.

@zo0m
Created February 19, 2017 19:39
Show Gist options
  • Save zo0m/72e6b2ff5e372e3b652c0fb43533390e to your computer and use it in GitHub Desktop.
Save zo0m/72e6b2ff5e372e3b652c0fb43533390e to your computer and use it in GitHub Desktop.
child-of SASS mixin
// thanks : http://thesassway.com/intermediate/referencing-parent-selectors-using-ampersand#comment-2067904467
@mixin child-of($parent) {
@at-root {
#{$parent} %child {
@content;
}
}
@extend %child;
}
body {
h3 {
font-size:18px;
@include child-of('#parent') {
font-weight:bold;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment