Spacing classes are named using the format {property}{side}-{spacer}
.
Where property is one of:
m
- for classes that setmargin
p
- for classes that setpadding
Where side is one of:
t
- for classes that setmargin-top
orpadding-top
b
- for classes that setmargin-bottom
orpadding-bottom
l
- for classes that setmargin-left
orpadding-left
r
- for classes that setmargin-right
orpadding-right
x
- for classes that set both*-left
and*-right
y
- for classes that set both*-top
and*-bottom
blank - for classes that set a margin
or padding
on all 4 sides of the element
Where spacer is one of:
- 0 - for classes that eliminate the
margin
orpadding
by setting it to0
- 1 - for classes that set the
margin
orpadding
to$spacer * .25
- 2 - for classes that set the
margin
orpadding
to$spacer * .5
- 3 - for classes that set the
margin
orpadding
to$spacer
- 4 - for classes that set the
margin
orpadding
to$spacer * 1.5
- 5 - for classes that set the
margin
orpadding
to$spacer * 3
- auto - for classes that set the
margin
toauto
$spacer
is default to 1rem
, you can change or add new entries to the $spacers
Sass map variable.
Examples
<div class="mt-2"></div>
<div style="margin-top: ($spacer * .5)"></div>
<div class="mx-3"></div>
<div class="margin-left: $spacer; margin-right: $spacer;"></div>
<div class="p-4"></div>
<div class="padding: ($spacer * 1.5);"></div>
PREVIOUSMarkdown Enhancements
NEXTGrid