Spacing Classes

The UDS Bootstrap theme creates its own variables for vertical spacing, which get folded into the Bootstrap utility classes for margins, padding, etc. (ex. mb-2, for ‘margin bottom 2 units’). Each spacing unit in the UDS system is 8px, so that same mb-2 would be ‘margin bottom 16px’, for example. Here is a table showing all the spacing units defined in the SCSS files, and how many pixels and rem they equal.

Things to note:

  • Sizes increase by 1/2 rem (8px) from 0 up to 10, then we start getting into larger jumps
  • The standard spacing between content sections (particularly when you are switching background colors or patterns)is 6 on mobile (48px) and 12 on desktop (96px), so you’ll use those quite often to create padding/margins.
Spacing ClassHow many REMHow many pixels
000
10.58
2116
31.524
4232
52.540
6348
73.556
8464
94.572
10580
12696
147112
168128
3216256
6432512
‘half’0.254
‘base’116