Skip to content

Instantly share code, notes, and snippets.

@johannesjo
Created April 9, 2015 19:04
Show Gist options
  • Save johannesjo/ab9518afd3351e57653b to your computer and use it in GitHub Desktop.
Save johannesjo/ab9518afd3351e57653b to your computer and use it in GitHub Desktop.
A row machine mixin that uses css calc to ease your rowing
@mixin rowMachineCalc($numPerRow, $margin) {
@include clearfix();
display: block;
> * {
width: calc(#{(100% / $numPerRow)} - #{(($numPerRow - 1) * $margin)/$numPerRow});
float: left;
&:nth-child(n) {
margin-bottom: $margin;
margin-right: $margin;
}
&:nth-child(#{$numPerRow}n) {
margin-right: 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment