Skip to content

Spacing Helper Classes

Our spacing system follows a strict scale to ensure visual consistency. Utility classes are constructed using the pattern:
.[type]-[direction]-[size]

Example: .m-t-s for margin-top: 16px or .p-x-xl for padding-left: 48px and padding-right: 48px.

Demo

m-r-xxl

p-xxl

Lorem ipsum dolor sit amet, consetetur sadipscing elitr.

m-l-s m-y-m

m-t-xs

Directions

The direction determines which side of the element the spacing is applied to.

KeyDirectionCSS Property Equivalent
tTop*-top
bBottom*-bottom
lLeft*-left
rRight*-right
xHorizontal*-left & *-right
yVertical*-top & *-bottom
(empty)All Sidesmargin or padding

Note: When using spacing mixins in SCSS, use the keyword "all" instead of an empty string to target all sides.

Spacing Scale

All sizes are based on a fixed pixel scale, mapped to Sass variables.

KeySize (px)Size (rem)Usage Context Examples
reset0px0Removing default browser margins
xxs4px0.25remMicro-adjustments
xs8px0.5remTight groupings / Icon spacing
s16px1remStandard small gap
m24px1.5remDefault component spacing
l32px2remSection gutters
xl48px3remLarge structural gaps
xxl64px4remDistinct page sections
xxxl96px6remHero section padding

Negative Margin Utilities

Negative margins are used to pull elements outside of their natural flow or to offset parent padding. These follow the naming convention: .-m-[direction]-[size].

Example ClassResult
.-m-l-xsmargin-left: -8px ($space-xs)
.-m-r-lmargin-right: -32px ($space-l)
.-m-t-lmargin-top: -32px ($space-l)
.-m-b-xxsmargin-bottom: -4px ($space-xxs)

SCSS Spacing Mixins

For internal component styling, use our shorthand mixins for padding (p) and margin (m). This ensures compliance with the design system scale.

Syntax: @include [type]([direction], [size]);

scss
.c-custom-card {
  @include p("all", "m"); // Padding: 24px on all sides
  @include m("t", "xl");  // Margin-top: 48px
}