Skip to content

Instantly share code, notes, and snippets.

@nicoxxxcox
Created February 23, 2020 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicoxxxcox/20c8f13cfd99925539eb25269dfc705a to your computer and use it in GitHub Desktop.
Save nicoxxxcox/20c8f13cfd99925539eb25269dfc705a to your computer and use it in GitHub Desktop.
Spacing utility
$vals: 768px, 992px, 1200px;
$breaks: sm, md, xl;
$base-space: 0.25rem;
@for $i from 0 through 4 {
.p-#{$i} {
padding: ($i * $base-space);
}
.pt-#{$i} {
padding-top: ($i * $base-space);
}
.pb-#{$i} {
padding-bottom: ($i * $base-space);
}
.pr-#{$i} {
padding-right: ($i * $base-space);
}
.pl-#{$i} {
padding-left: ($i * $base-space);
}
.px-#{$i} {
padding-left: ($i * $base-space);
padding-right: ($i * $base-space);
}
.py-#{$i} {
padding-top: ($i * $base-space);
padding-bottom: ($i * $base-space);
}
}
@for $i from 0 through 4 {
.m-#{$i} {
margin: ($i * $base-space);
}
.mt-#{$i} {
margin-top: ($i * $base-space);
}
.mb-#{$i} {
margin-bottom: ($i * $base-space);
}
.mr-#{$i} {
margin-right: ($i * $base-space);
}
.ml-#{$i} {
margin-left: ($i * $base-space);
}
.mx-#{$i} {
margin-left: ($i * $base-space);
margin-right: ($i * $base-space);
}
.my-#{$i} {
margin-top: ($i * $base-space);
margin-bottom: ($i * $base-space);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment