Created
May 16, 2016 02:36
-
-
Save sundaycrafts/ebef345b9e79ea6e55fcbe6e624f96d4 to your computer and use it in GitHub Desktop.
make flexible col mixin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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