Created
October 9, 2014 18:18
-
-
Save mootari/1c95efe8cbcae6d9b4cc to your computer and use it in GitHub Desktop.
followed-by: Apply content to adjacent siblings. #sassmeister #mixin
This file contains 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
// ---- | |
// Sass (v3.4.4) | |
// Compass (v1.0.1) | |
// ---- | |
@mixin followed-by($selectors...) { | |
$placeholder: "%#{unique_id()}"; | |
@at-root #{$placeholder} { | |
@content; | |
} | |
@each $selector in $selectors { | |
+ #{$selector} { | |
@extend #{$placeholder}; | |
} | |
} | |
} | |
.formatted p { | |
@include followed-by(ul, ol) { | |
margin-top: 10px; | |
} | |
} |
This file contains 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
.formatted p + ul, .formatted p + ol { | |
margin-top: 10px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment