Where *size* is one of:
* `0` - for classes that eliminate the `margin` or `padding` by setting it to `0`
-* `1` - (by default) for classes that set the `margin` or `padding` to `$spacer * .25` or `$spacer * .25`
-* `2` - (by default) for classes that set the `margin` or `padding` to `$spacer * .5` or `$spacer * .5`
-* `3` - (by default) for classes that set the `margin` or `padding` to `$spacer` or `$spacer`
-* `4` - (by default) for classes that set the `margin` or `padding` to `$spacer * 1.5` or `$spacer * 1.5`
-* `5` - (by default) for classes that set the `margin` or `padding` to `$spacer * 3` or `$spacer * 3`
+* `1` - (by default) for classes that set the `margin` or `padding` to `$spacer * .25`
+* `2` - (by default) for classes that set the `margin` or `padding` to `$spacer * .5`
+* `3` - (by default) for classes that set the `margin` or `padding` to `$spacer`
+* `4` - (by default) for classes that set the `margin` or `padding` to `$spacer * 1.5`
+* `5` - (by default) for classes that set the `margin` or `padding` to `$spacer * 3`
(You can add more sizes by adding entries to the `$spacers` Sass map variable.)
}
.p-3 {
- padding: $spacer $spacer !important;
+ padding: $spacer !important;
}
{% endhighlight %}
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
@each $prop, $abbrev in (margin: m, padding: p) {
- @each $size, $lengths in $spacers {
- $length-x: map-get($lengths, x);
- $length-y: map-get($lengths, y);
+ @each $size, $length in $spacers {
- .#{$abbrev}#{$infix}-#{$size} { #{$prop}: $length-y $length-x !important; }
- .#{$abbrev}t#{$infix}-#{$size} { #{$prop}-top: $length-y !important; }
- .#{$abbrev}r#{$infix}-#{$size} { #{$prop}-right: $length-x !important; }
- .#{$abbrev}b#{$infix}-#{$size} { #{$prop}-bottom: $length-y !important; }
- .#{$abbrev}l#{$infix}-#{$size} { #{$prop}-left: $length-x !important; }
+ .#{$abbrev}#{$infix}-#{$size} { #{$prop}: $length !important; }
+ .#{$abbrev}t#{$infix}-#{$size} { #{$prop}-top: $length !important; }
+ .#{$abbrev}r#{$infix}-#{$size} { #{$prop}-right: $length !important; }
+ .#{$abbrev}b#{$infix}-#{$size} { #{$prop}-bottom: $length !important; }
+ .#{$abbrev}l#{$infix}-#{$size} { #{$prop}-left: $length !important; }
.#{$abbrev}x#{$infix}-#{$size} {
- #{$prop}-right: $length-x !important;
- #{$prop}-left: $length-x !important;
+ #{$prop}-right: $length !important;
+ #{$prop}-left: $length !important;
}
.#{$abbrev}y#{$infix}-#{$size} {
- #{$prop}-top: $length-y !important;
- #{$prop}-bottom: $length-y !important;
+ #{$prop}-top: $length !important;
+ #{$prop}-bottom: $length !important;
}
}
}