Skip to content

Instantly share code, notes, and snippets.

@elfacht
Last active October 21, 2021 04:59
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 elfacht/9b4603e67b8368da34f28f68a576cb66 to your computer and use it in GitHub Desktop.
Save elfacht/9b4603e67b8368da34f28f68a576cb66 to your computer and use it in GitHub Desktop.
Modify elements in last row
// Modify the items in the last row
// @param {Number} $range
// @param {String} $selector
@mixin u-last-row($range: 2, $selector: '.selector') {
&:nth-last-child(-n+#{$range}):nth-child(#{$range}n+1),
&:nth-last-child(-n+#{$range}):nth-child(#{$range}n+1) ~ #{$selector} {
@content;
}
}
@include u-last-row(2, '.selector') {
margin-bottom: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment