Skip to content

Instantly share code, notes, and snippets.

@cahnory
Created December 4, 2013 10:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cahnory/7785578 to your computer and use it in GitHub Desktop.
Save cahnory/7785578 to your computer and use it in GitHub Desktop.
Split rule by selectors
@mixin split($selectors...) {
@each $selector in $selectors {
#{$selector} {
@content;
}
}
}
p {
background: #00F;
}
p::selection {
background: #F00;
color: #FFF;
}
p::-moz-selection {
background: #F00;
color: #FFF;
}
p::-webkit-selection {
background: #F00;
color: #FFF;
}
p {
background: #00F;
@include split('&::selection','&::-moz-selection','&::-webkit-selection') {
background: #F00;
color: #FFF;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment