_spacing.scss 1.34 KB
Newer Older
1
// Margin and Padding
2

3
@each $breakpoint in map-keys($grid-breakpoints) {
4
5
  @include media-breakpoint-up($breakpoint) {
    $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
6

7
    @each $prop, $abbrev in (margin: m, padding: p) {
Starsam80's avatar
Starsam80 committed
8
      @each $size, $length in $spacers {
9

Starsam80's avatar
Starsam80 committed
10
        .#{$abbrev}#{$infix}-#{$size}  { #{$prop}:        $length !important; }
11
12
13
14
15
        .#{$abbrev}t#{$infix}-#{$size},
        .#{$abbrev}y#{$infix}-#{$size} {
          #{$prop}-top: $length !important;
        }
        .#{$abbrev}r#{$infix}-#{$size},
16
        .#{$abbrev}x#{$infix}-#{$size} {
Starsam80's avatar
Starsam80 committed
17
          #{$prop}-right: $length !important;
18
        }
19
        .#{$abbrev}b#{$infix}-#{$size},
20
        .#{$abbrev}y#{$infix}-#{$size} {
Starsam80's avatar
Starsam80 committed
21
          #{$prop}-bottom: $length !important;
22
        }
23
24
25
26
        .#{$abbrev}l#{$infix}-#{$size},
        .#{$abbrev}x#{$infix}-#{$size} {
          #{$prop}-left: $length !important;
        }
27
      }
28
    }
Mark Otto's avatar
Mark Otto committed
29

30
31
    // Some special margin utils
    .m#{$infix}-auto  { margin:        auto !important; }
32
33
34
35
36
    .mt#{$infix}-auto,
    .my#{$infix}-auto {
      margin-top: auto !important;
    }
    .mr#{$infix}-auto,
Mark Otto's avatar
Mark Otto committed
37
38
39
    .mx#{$infix}-auto {
      margin-right: auto !important;
    }
40
    .mb#{$infix}-auto,
Mark Otto's avatar
Mark Otto committed
41
    .my#{$infix}-auto {
42
      margin-bottom: auto !important;
Mark Otto's avatar
Mark Otto committed
43
    }
44
45
46
47
    .ml#{$infix}-auto,
    .mx#{$infix}-auto {
      margin-left: auto !important;
    }
Mark Otto's avatar
Mark Otto committed
48
  }
49
}