Skip to content

Instantly share code, notes, and snippets.

@sundaycrafts
Created May 16, 2016 02:36
Show Gist options
  • Save sundaycrafts/ebef345b9e79ea6e55fcbe6e624f96d4 to your computer and use it in GitHub Desktop.
Save sundaycrafts/ebef345b9e79ea6e55fcbe6e624f96d4 to your computer and use it in GitHub Desktop.
make flexible col mixin
@mixin make-col($ref, $margin, $col, $reverse: false) {
$marginSum: $margin*($col - 1);
$itemWidth: floor(($ref -$marginSum)/$col);
width: percentage($itemWidth/$ref);
@if ($reverse == true) {
float: right;
margin-left: percentage($margin/$ref);
&:last-child {
margin-left: 0;
}
} @else {
float: left;
margin-right: percentage($margin/$ref);
&:last-child {
margin-right: 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment