Spacing classes are named using the format {property}{side}-{spacer}.
Where property is one of:
m- for classes that setmarginp- for classes that setpadding
Where side is one of:
t- for classes that setmargin-toporpadding-topb- for classes that setmargin-bottomorpadding-bottoml- for classes that setmargin-leftorpadding-leftr- for classes that setmargin-rightorpadding-rightx- for classes that set both*-leftand*-righty- for classes that set both*-topand*-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
marginorpaddingby setting it to0 - 1 - for classes that set the
marginorpaddingto$spacer * .25 - 2 - for classes that set the
marginorpaddingto$spacer * .5 - 3 - for classes that set the
marginorpaddingto$spacer - 4 - for classes that set the
marginorpaddingto$spacer * 1.5 - 5 - for classes that set the
marginorpaddingto$spacer * 3 - auto - for classes that set the
margintoauto
$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