Skip to content

Instantly share code, notes, and snippets.

@dbox
Created November 19, 2014 16:03
Show Gist options
  • Save dbox/4d04c1287931fc9e0076 to your computer and use it in GitHub Desktop.
Save dbox/4d04c1287931fc9e0076 to your computer and use it in GitHub Desktop.
// Freaking easy responsive rows of items by @chriscoyier
// Freaking easy responsive rows of items by @chriscoyier (http://css-tricks.com/video-screencasts/132-quick-useful-case-sass-math-mixins/)
@mixin rowMachine($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