Spacing
Notation #
Spacing utility classes can be defined using the format -{property}{sides}[-{breakpoint}]--{size}
.
{property} #
m
- use to applymargin
p
- use to applypadding
{sides} #
t
- use to applymargin-top
orpadding-top
b
- use to applymargin-bottom
orpadding-bottom
l
- use to applymargin-left
orpadding-left
r
- use to applymargin-right
orpadding-right
x
- use to applymargin-left
andmargin-right
orpadding-left
andpadding-right
y
- use to applymargin-top
andmargin-bottom
orpadding-top
andpadding-bottom
- blank - leave blank to apply
margin
orpadding
to all 4 sides.
{breakpoint} #
Optionally, include -{breakpoint} to apply the utility behaviour to some breakpoints. As a mobile-first library, any applying to smaller breakpoints will also modify larger ones unless another class overrides this behaviour.
- blank - leave blank to apply
margin
orpadding
to all breakpoints. sm
- use to applymargin
orpadding
to sm and larger breakpoints.md
- use to applymargin
orpadding
to md and larger breakpoints.lg
- use to applymargin
orpadding
to lg and larger breakpoints.xl
- use to applymargin
orpadding
to xl breakpoints.
{size} #
0
- use to eliminate existingmargin
orpadding
and set to0
1
- use to setmargin
orpadding
to$base-unit
2
- use to setmargin
orpadding
to$base-unit * 2
3
- use to setmargin
orpadding
to$base-unit * 3
4
- use to setmargin
orpadding
to$base-unit * 4
5
- use to setmargin
orpadding
to$base-unit * 5
6
- use to setmargin
orpadding
to$base-unit * 6
7
- use to setmargin
orpadding
to$base-unit * 7
8
- use to setmargin
orpadding
to$base-unit * 8
9
- use to setmargin
orpadding
to$base-unit * 9
10
- use to setmargin
orpadding
to$base-unit * 10
auto
- use to setmargin
toauto
value
Examples #
Margins #
In this example, various margin classes have been applied to render margin on all 4 sides of the blue squares. The margin can be visualized in blue.
Side Margins #
Apply margin to specific sides of an element by adding t
,
b
, l
, r
, x
or y
to the class name.
Padding #
In this example, various padding classes have been applied to render padding on all 4 sides of the blue squares. The padding can be visualized in yellow.
Side Paddings #
Apply padding to specific sides of an element by adding t
,
b
, l
, r
, x
or y
to the class name.