Created
February 19, 2017 19:39
-
-
Save zo0m/72e6b2ff5e372e3b652c0fb43533390e to your computer and use it in GitHub Desktop.
child-of SASS mixin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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