// Margin and Padding // ======================================================================== // variable // ----------------------- $as_lengths: 0, 3, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 100 !default; $as_lengths_negative: -30, -25, -20, -15, -10, -5, -3, -1 !default; $negative-infix: '' !default; @each $breakpoint in map-keys($grid-breakpoints) { @include media-breakpoint-up($breakpoint) { $infix: breakpoint-infix($breakpoint, $grid-breakpoints); @each $prop, $abbrev in (margin: m, padding: p) { @each $length in $as_lengths { $value : if($length != 0, $length * 1px, 0); .#{$abbrev}#{$infix}-#{$length} { #{$prop}: $value !important; } .#{$abbrev}t#{$infix}-#{$length} { #{$prop}-top: $value !important; } .#{$abbrev}r#{$infix}-#{$length} { #{$prop}-right: $value !important; } .#{$abbrev}b#{$infix}-#{$length} { #{$prop}-bottom: $value !important; } .#{$abbrev}l#{$infix}-#{$length} { #{$prop}-left: $value !important; } .#{$abbrev}x#{$infix}-#{$length} { #{$prop}-right: $value !important; #{$prop}-left: $value !important; } .#{$abbrev}y#{$infix}-#{$length} { #{$prop}-top: $value !important; #{$prop}-bottom: $value !important; } } } @each $prop, $abbrev in (margin: m) { @each $length in $as_lengths_negative { $value : abs($length) * (-1px); $length: #{$negative-infix}#{$length}; .#{$abbrev}#{$infix}-#{$length} { #{$prop}: $value !important; } .#{$abbrev}t#{$infix}-#{$length} { #{$prop}-top: $value !important; } .#{$abbrev}r#{$infix}-#{$length} { #{$prop}-right: $value !important; } .#{$abbrev}b#{$infix}-#{$length} { #{$prop}-bottom: $value !important; } .#{$abbrev}l#{$infix}-#{$length} { #{$prop}-left: $value !important; } .#{$abbrev}x#{$infix}-#{$length} { #{$prop}-right: $value !important; #{$prop}-left: $value !important; } .#{$abbrev}y#{$infix}-#{$length} { #{$prop}-top: $value !important; #{$prop}-bottom: $value !important; } } } // Some special margin utils .m#{$infix}-auto { margin: auto !important; } .mt#{$infix}-auto { margin-top: auto !important; } .mr#{$infix}-auto { margin-right: auto !important; } .mb#{$infix}-auto { margin-bottom: auto !important; } .ml#{$infix}-auto { margin-left: auto !important; } .mx#{$infix}-auto { margin-right: auto !important; margin-left: auto !important; } .my#{$infix}-auto { margin-top: auto !important; margin-bottom: auto !important; } } }