Skip to content

Instantly share code, notes, and snippets.

@gunnarbittersmann
Created December 26, 2014 07:10
Show Gist options
  • Save gunnarbittersmann/ceb085f6e7146721165b to your computer and use it in GitHub Desktop.
Save gunnarbittersmann/ceb085f6e7146721165b to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.9)
// Compass (v1.0.1)
// ----
@mixin nth-children($n, $m: $n/2)
{
$selectorlist: null;
@for $i from 1 to $m+1
{
$selectorlist: append($selectorlist, unquote("&:nth-child(#{$n}n+#{$i})"), comma);
}
#{$selectorlist}
{
@content;
}
}
li
{
@include nth-children(24)
{
background: red;
}
}
li:nth-child(24n+1), li:nth-child(24n+2), li:nth-child(24n+3), li:nth-child(24n+4), li:nth-child(24n+5), li:nth-child(24n+6), li:nth-child(24n+7), li:nth-child(24n+8), li:nth-child(24n+9), li:nth-child(24n+10), li:nth-child(24n+11), li:nth-child(24n+12) {
background: red;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment