Skip to content

Instantly share code, notes, and snippets.

@pjschreifels
Created June 29, 2013 23:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save pjschreifels/5893129 to your computer and use it in GitHub Desktop.
Save pjschreifels/5893129 to your computer and use it in GitHub Desktop.
#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