Create a gist now

Instantly share code, notes, and snippets.

#layout #less - Create top, right, bottom and left margin classes from 0px to 50px in 5px increments. Use as .mt_x, mb_x, mr_x, ml_x (top, bottom, right left margin, respectively), where x is a number from 0 to 50.
// Margin classes
// -------------------------
@from : 0;
@to : 50;
.loop(@index) when(@index =< @to) {
.mt_@{index} {
margin-top: unit(@index, px);
}
.mb_@{index} {
margin-bottom: unit(@index, px);
}
.mr_@{index} {
margin-right: unit(@index, px);
}
.ml_@{index} {
margin-left: unit(@index, px);
}
.loop(@index + 5);
}
.loop(@from);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment