Skip to content

Instantly share code, notes, and snippets.

@cheh
Created January 17, 2014 20:35
Show Gist options
  • Save cheh/8480917 to your computer and use it in GitHub Desktop.
Save cheh/8480917 to your computer and use it in GitHub Desktop.
Calc width for column
// var
@margin : 2%;
// mixin
.colsWidth(@margin, @num_cols : 1) {
width: ( 100 - @margin * ( @num_cols - 1 ) ) / @num_cols;
}
// style.less
.price-cols-2 .col { .colsWidth(@margin, 2); }
.price-cols-3 .col { .colsWidth(@margin, 3); }
.price-cols-4 .col { .colsWidth(@margin, 4); }
.price-cols-5 .col { .colsWidth(@margin, 5); }
.price-cols-6 .col { .colsWidth(@margin, 6); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment