Created
March 12, 2014 12:48
-
-
Save james-jlo-long/9506269 to your computer and use it in GitHub Desktop.
Liquid grid in LESS
This file contains 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
* { | |
&, | |
&:after, | |
&:before { | |
-webkit-box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
box-sizing: border-box; | |
} | |
} | |
[class*="grid_"] { | |
float: left; | |
} | |
.grid:after { | |
clear: both; | |
content: ""; | |
display: table; | |
} | |
#grid { | |
.size(@units, @columns) { | |
@selector: ~".grid_@{units}of@{columns}"; | |
@{selector} { width: unit(@units * (100 / @columns), ~"%"); } | |
} | |
.loop(@index, @columns) when (@index > 0) { | |
#grid > .size(@index, @columns); | |
#grid > .loop(@index - 1, @columns); | |
} | |
.make(@columns) { | |
#grid > .loop(@columns - 1, @columns); | |
} | |
} | |
#grid > .make(2); | |
#grid > .make(3); | |
#grid > .make(4); | |
#grid > .make(5); | |
#grid > .make(6); | |
#grid > .make(8); | |
#grid > .make(12); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment