Spacing
A range of classes and variables to assign margin and padding property values to elements. There 6 different spacing values ranging from tiny
to huge
. There are also responsive classes available to adjust an element's spacing for each breakpoint.
Classes
Spacing
Use classes to assign margin or padding values to adjust individual properties, all properties, and vertical and horizontal properties. Classes are named using the format:
{property}--{size}
for all sides{property}{sides}--{size}
for individual sides{property}{sides}-{breakpoint}-{size}
for responsive
Where the property of m
sets margin and p
sets padding.
Where sides
is one of:
t
- for classes that setmargin-top
orpadding-top
r
- for classes that setmargin-right
orpadding-right
b
- for classes that setmargin-bottom
orpadding-bottom
l
- for classes that setmargin-left
orpadding-left
y
- for classes that set both*-top
and*-bottom
x
- for classes that set both*-left
and*-right
Where size
is one of:
- base with value set to
16px
or1rem
- tiny with value set to
8px
or.5rem
- medium with value set to
24px
or1.5rem
- large with value set to
32px
or2rem
- xlarge with value set to
48px
or3rem
- huge with value set to
64px
or4rem
Responsive Classes
Using responsive classes we can adjust the padding bottom in the examples for different screen sizes. In example #1 the spacing is set to tiny on desktop and adjusts to huge on mobile using pb-sm--tiny pb--huge
. In example #2 the spacing is set to large on desktop and huge on tablets using pb-md--large pb--huge
.