Skip to content

Instantly share code, notes, and snippets.

@luisramirezdev
Last active August 4, 2021 07:41
Show Gist options
  • Save luisramirezdev/5c422ef9c09fbdf00e76b191f1f6da69 to your computer and use it in GitHub Desktop.
Save luisramirezdev/5c422ef9c09fbdf00e76b191f1f6da69 to your computer and use it in GitHub Desktop.
Margin and padding space class generator like Bootstrap (Utility Classes)
$spacer: 8px;
$spaces: (
0: 0,
1: (
$spacer
),
2: (
$spacer * 2
),
3: (
$spacer * 3
),
4: (
$spacer * 4
),
5: (
$spacer * 5
),
6: (
$spacer * 6
)
);
$sides: (top, bottom, left, right);
@each $key, $space in $spaces {
@each $side in $sides {
.m#{str-slice($side, 0, 1)}-#{$key} {
margin-#{$side}: #{$space} !important;
}
.p#{str-slice($side, 0, 1)}-#{$key} {
padding-#{$side}: #{$space} !important;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment