Created
December 13, 2016 09:02
-
-
Save peeke/e84ee443a49701340654d2c3c9b72c8a to your computer and use it in GitHub Desktop.
Hide items that remains after a division by n.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hide items that remains after a division by n. | |
// E.g.: when using remaining-items(3) on a set of 8 elements, the last two items will be hidden. | |
@mixin remaining-items($n-per-row) { | |
&:nth-child(n+#{$n-per-row}) { | |
&:nth-last-child(-n+#{$n-per-row}) { | |
&:nth-child(#{$n-per-row}n+#{$n-per-row}) ~ * { | |
@content; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment