Spacing

Defined values are used for padding, margin, and position coordinates.

Spacing is defined using REM (root em) proportions that are relative to the font size of the root element of the browser. We do not set a root em as this would create accessibility problems for users who may wish to set a different root em. For most users the default rem will be 16px. The pixel equivalents below assume a root em of 16px. The intention is that if a user sets a different root em in their browser settings the site design should scale accordingly.

Developers should, wherever possible, use the global SCSS variables when developing components. Directly setting the sizes (using px, em, rem, etc) within a component’s SCSS should be avoided.

Variables

SCSS var
$spacing-1
REM value
0.25rem
Pixel equivalent
4px
SCSS var
$spacing-2
REM value
0.5rem
Pixel equivalent
8px
SCSS var
$spacing-3
REM value
0.75rem
Pixel equivalent
12px
SCSS var
$spacing-4
REM value
1rem
Pixel equivalent
16px
SCSS var
$spacing-5
REM value
1.5rem
Pixel equivalent
24px
SCSS var
$spacing-6
REM value
2rem
Pixel equivalent
32px
SCSS var
$spacing-7
REM value
3rem
Pixel equivalent
48px
SCSS var
$spacing-8
REM value
4rem
Pixel equivalent
64px
SCSS var
$spacing-9
REM value
5rem
Pixel equivalent
80px

Margins and padding

Spacing can be applied using margin or padding. Both margin and padding share the same predefined scale.

$spacing-1
$spacing-2
$spacing-3
$spacing-4
$spacing-5
$spacing-6
$spacing-7
$spacing-8
$spacing-9