Skip to content

Instantly share code, notes, and snippets.

@jakiestfu
Last active August 29, 2015 14:08
Show Gist options
  • Select an option

  • Save jakiestfu/0f8f44079df2f4c80560 to your computer and use it in GitHub Desktop.

Select an option

Save jakiestfu/0f8f44079df2f4c80560 to your computer and use it in GitHub Desktop.
Creates a bunch of helpful padding/margin classes
.margin { margin: 10px; }
.no-margin { margin: 0 !important; }
.m-top { margin-top: 5px !important; }
.m-top-more { margin-top: 10px !important; }
.m-right { margin-right: 5px !important; }
.m-right-more { margin-right: 10px !important; }
.m-bottom { margin-bottom: 5px !important; }
.m-bottom-more { margin-bottom: 10px !important; }
.m-left { margin-left: 5px !important; }
.m-left-more { margin-left: 10px !important; }
.padding { padding: 10px; }
.no-padding { padding: 0 !important; }
.p-top { padding-top: 5px !important; }
.p-top-more { padding-top: 10px !important; }
.p-right { padding-right: 5px !important; }
.p-right-more { padding-right: 10px !important; }
.p-bottom { padding-bottom: 5px !important; }
.p-bottom-more { padding-bottom: 10px !important; }
.p-left { padding-left: 5px !important; }
.p-left-more { padding-left: 10px !important; }
$sides: "top" "right" "bottom" "left";
$props: "margin" "padding";
$size: 5px;
@each $prop in $props {
.#{$prop} {
#{$prop}: $size*2;
}
.no-#{$prop} {
#{$prop}: 0 !important;
}
$selector: unquote(".#{str-slice($prop, 0,1)}");
@each $side in $sides {
#{$selector}-#{$side} {
#{$prop}-#{$side}: $size !important;
}
#{$selector}-#{$side}-more {
#{$prop}-#{$side}: $size*2 !important;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment