Skip to content

Instantly share code, notes, and snippets.

@jayontraps
Created April 27, 2019 05:41
Show Gist options
  • Save jayontraps/9a05596576a90d6083910dde0d7036b9 to your computer and use it in GitHub Desktop.
Save jayontraps/9a05596576a90d6083910dde0d7036b9 to your computer and use it in GitHub Desktop.
sass mixin define columns
@mixin defineCols($numPerRow, $margin) {
width: ((100% - (($numPerRow - 1) * $margin)) / $numPerRow);
&:nth-child(n) {
margin-bottom: $margin;
margin-right: $margin;
}
&:nth-child(#{$numPerRow}n) {
margin-right: 0;
margin-bottom: 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment