_spacing.scss 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // stylelint-disable declaration-no-important
  2. // Margin and Padding
  3. @each $breakpoint in map-keys($grid-breakpoints) {
  4. @include media-breakpoint-up($breakpoint) {
  5. $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
  6. @each $prop, $abbrev in (margin: m, padding: p) {
  7. @each $size, $length in $spacers {
  8. .#{$abbrev}#{$infix}-#{$size} { #{$prop}: $length !important; }
  9. .#{$abbrev}t#{$infix}-#{$size},
  10. .#{$abbrev}y#{$infix}-#{$size} {
  11. #{$prop}-top: $length !important;
  12. }
  13. .#{$abbrev}r#{$infix}-#{$size},
  14. .#{$abbrev}x#{$infix}-#{$size} {
  15. #{$prop}-right: $length !important;
  16. }
  17. .#{$abbrev}b#{$infix}-#{$size},
  18. .#{$abbrev}y#{$infix}-#{$size} {
  19. #{$prop}-bottom: $length !important;
  20. }
  21. .#{$abbrev}l#{$infix}-#{$size},
  22. .#{$abbrev}x#{$infix}-#{$size} {
  23. #{$prop}-left: $length !important;
  24. }
  25. }
  26. }
  27. // Some special margin utils
  28. .m#{$infix}-auto { margin: auto !important; }
  29. .mt#{$infix}-auto,
  30. .my#{$infix}-auto {
  31. margin-top: auto !important;
  32. }
  33. .mr#{$infix}-auto,
  34. .mx#{$infix}-auto {
  35. margin-right: auto !important;
  36. }
  37. .mb#{$infix}-auto,
  38. .my#{$infix}-auto {
  39. margin-bottom: auto !important;
  40. }
  41. .ml#{$infix}-auto,
  42. .mx#{$infix}-auto {
  43. margin-left: auto !important;
  44. }
  45. }
  46. }