Skip to content

Instantly share code, notes, and snippets.

@dextermb
Forked from pjschreifels/Margin Loop for LESS
Last active December 2, 2017 16:22
Show Gist options
  • Save dextermb/d2b6e14b1b0f452ee77d45699c31861d to your computer and use it in GitHub Desktop.
Save dextermb/d2b6e14b1b0f452ee77d45699c31861d 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) {
.m-t-@{index} {
margin-top: unit(@index, px);
}
.m-b-@{index} {
margin-bottom: unit(@index, px);
}
.m-r-@{index} {
margin-right: unit(@index, px);
}
.m-l-@{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