Skip to content

Instantly share code, notes, and snippets.

@bitpshr
Last active December 25, 2015 13:19
Show Gist options
  • Save bitpshr/6983021 to your computer and use it in GitHub Desktop.
Save bitpshr/6983021 to your computer and use it in GitHub Desktop.
Simple fixed-width LESS mixin
@gridWidth: 1170;
@gutterWidth: 30;
@numberOfColumns: 12;
@columnWidth: (@gridWidth - ((@numberOfColumns - 1) * @gutterWidth)) / @numberOfColumns;
.row {
width: 1170px;
margin: 0 auto;
overflow: hidden;
}
.loop (@index) when (@index > 0) {
.span-@{index} {
overflow: hidden;
float: left;
display: inline;
width: unit((@index * @columnWidth) + ((@index - 1) * @gutterWidth), px);
}
.loop(@index - 1);
}
.loop (0) {}
.loop (@numberOfColumns);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment