Skip to content

Instantly share code, notes, and snippets.

@peeke
Created December 13, 2016 09:02
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 peeke/e84ee443a49701340654d2c3c9b72c8a to your computer and use it in GitHub Desktop.
Save peeke/e84ee443a49701340654d2c3c9b72c8a to your computer and use it in GitHub Desktop.
Hide items that remains after a division by n.
// 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