Skip to content

Instantly share code, notes, and snippets.

@wiyoe
Last active April 26, 2018 12:56
Show Gist options
  • Select an option

  • Save wiyoe/cfab9e36d49ed1de33d480b4c526876c to your computer and use it in GitHub Desktop.

Select an option

Save wiyoe/cfab9e36d49ed1de33d480b4c526876c to your computer and use it in GitHub Desktop.
Sass default margins and paddings generator.
$size: 8;
$margins: (mb: margin-bottom, mt: margin-top, mr: margin-right, ml: margin-left);
@each $key, $item in $margins {
@for $i from 1 through $size {
.#{$key}-#{$i} {
#{$item}: (2em * $i) / 4;
}
}
}
$paddings: (pb: padding-bottom, pt: padding-top, pr: padding-right, pl: padding-left);
@each $key, $item in $paddings {
@for $i from 1 through $size {
.#{$key}-#{$i} {
#{$item}: #{$i}px!important;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment