Skip to content

Instantly share code, notes, and snippets.

@jakob-e
Last active December 7, 2015 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakob-e/47a05fb54973156119b3 to your computer and use it in GitHub Desktop.
Save jakob-e/47a05fb54973156119b3 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
</ul>
// ----
// libsass (v3.2.5)
// ----
@mixin nth-child($values...){
$sel:();
@each $value in $values {
$sel: append($sel, unquote('#{&}:nth-child(#{$value})'), comma);
}
@at-root {
#{$sel}{ @content; }
}
}
ul {
li {
@include nth-child(4, 3n){
background-color:tomato;
}
}
}
ul li ul li:nth-child(4), ul li ul li:nth-child(3n) {
background-color: tomato;
}
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment