ul li {
background: red;
@include first(3) {
background: red
}
}
ul li {
background: red;
}
ul li:nth-child(-n + 3) {
background: red;
}
WithArguments
first
@include first(3)
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
last
@include last(3)
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
after-first
@include after-first(5)
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
from-end
@include from-end(3)
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
between
@include between(3, 6)
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
even-between
@include even-between(3, 12)
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
●11
●12
●13
●14
●15
odd-between
@include odd-between(3, 13)
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
●11
●12
●13
●14
●15
n-between
@include n-between(3,3,13)
// This mixin uses 3 arguments, the first one is equal to N item,
// the second is the starting item and the thirs the end item.
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
●11
●12
●13
●14
●15
all-but
@include all-but(3)
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
each
@include each(3)
// Alias of each() @include every(3)
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
from-first-last
@include from-first-last(2)
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
middle
@include middle(11)
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
●11
all-but-first-last
@include all-but-first-last(2)
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
●11
Quantityqueries
first-of
@include first-of(10)
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
last-of
@include last-of(10)
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
at-least
@include at-least(5)
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
at-most
@include at-most(5)
●1
●2
●3
●4
●5
in-between
@include in-between(5, 10)
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
Withoutarguments
first-child
@include first-child()
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
last-child
@include last-child()
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
even
@include even()
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
odd
@include odd()
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
first-last
@include first-last()
●1
●2
●3
●4
●5
●6
●7
●8
●9
●10
unique
@include unique()
●1
not-unique
@include not-unique()
●1
Usingfunctions
child-index()
Applyanorderedz-indexovereachchild.
// Basic usage @include child-index(10); // equivalent of @include child-index(10, forward, 0) // This mixin can take up to 3 arguments : // $num : Number of child to index // $direction : Direction of the indexing [ forward / backward ] // $index : Base indexing number [1, 10, 20 => 1, 2, 3; 11, 12, 13; 21, 22, 23 ] @include child-index(5, backward, 10);