Family.scss is a set of 26 smart Sass mixins which will help you to manage the style of :nth-child
’ified elements, in an easy and classy way.
The goal of this project is to unleash the power of the nth-child property, in an easy way.
The best way to understand each and every mixin, is to read it, literally.
For example: first(3) => first three
Each and every mixin is really easy to use, proceed like this:
ul li {
background: red;
@include first(3) {
background: red
}
}
ul li {
background: red;
}
ul li:nth-child(-n + 3) {
background: red;
}
@include first(3)
@include last(3)
@include after-first(5)
@include from-end(3)
@include between(3, 6)
@include even-between(3, 12)
@include odd-between(3, 13)
@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.
@include all-but(3)
@include each(3)
// Alias of each()
@include every(3)
@include from-first-last(2)
@include middle(11)
@include all-but-first-last(2)
@include first-of(10)
@include last-of(10)
@include at-least(5)
@include at-most(5)
@include in-between(5, 10)
@include first-child()
@include last-child()
@include even()
@include odd()
@include first-last()
@include unique()
@include not-unique()
Apply an ordered z-index
over each child.
// 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);
This project is a small library of Sass mixins, created by @LukyVj on his spare time.
You can find the header pattern generator on codepen
My colleagues from Algolia and my bros from bullgit for their feedback.
This page was made possible because of some awesome projects & scripts :