Created
August 18, 2015 08:31
-
-
Save jesusoterogomez/f67e5243870106e8ee12 to your computer and use it in GitHub Desktop.
Equal percentage width elements in one row using SASS
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
/* | |
Counts elements and applies percentage width to | |
fit them in one row. | |
################################################## | |
# i.e: 4 elements = 25% width; # | |
# note: Many elements create long CSS output # | |
################################################## | |
*/ | |
$min: 1; | |
$max: 5; | |
@for $i from $min through $max { | |
li:first-child:nth-last-child(#{$i}), | |
li:first-child:nth-last-child(#{$i}) ~ li { | |
width: 100%/$i | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment