Skip to content

Instantly share code, notes, and snippets.

@artp1ay
Created August 10, 2020 12:53
Show Gist options
  • Save artp1ay/08f84887936347d3727923d199c08f69 to your computer and use it in GitHub Desktop.
Save artp1ay/08f84887936347d3727923d199c08f69 to your computer and use it in GitHub Desktop.
Bulma padding and margin helper
$size-7: 10px;
$size-6: 20px;
$size-5: 30px;
$size-4: 40px;
$size-3: 50px;
$size-2: 60px;
$size-1: 70px;
$sizes: (1, 2, 3, 4, 5, 6, 7);
$positions: ("top", "left", "bottom", "right");
$bulmaSizes: ($size-1, $size-2, $size-3, $size-4, $size-5, $size-6, $size-7);
$i: 1;
@each $size in $sizes {
$sizee: nth($bulmaSizes, $i);
$i: $i+1;
.has-margin-#{$size} {
margin: $sizee !important;
}
.has-negative-margin-#{$size} {
margin: -$sizee !important;
}
.has-padding-#{$size} {
padding: $sizee !important;
}
@each $position in $positions {
.has-margin-#{$position}-#{$size} {
margin-#{$position}: $sizee !important;
}
.has-padding-#{$position}-#{$size} {
padding-#{$position}: $sizee !important;
}
.has-negative-margin-#{$position}-#{$size} {
margin-#{$position}: -$sizee !important;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment