Use shorthand margin and padding utility classes to control spacing between elements.
Spacing utility classes can be defined using the format -{property}{sides}{size}.
m - use to apply marginp - use to apply paddingt - use to apply margin-top or padding-topb - use to apply margin-bottom or padding-bottoml - use to apply margin-left or padding-leftr - use to apply margin-right or padding-rightmargin or padding to all 4 sides.0 - use to eliminate existing margin or padding and set to 01 - use to set margin or padding to $base-unit2 - use to set margin or padding to $base-unit * 23 - use to set margin or padding to $base-unit * 34 - use to set margin or padding to $base-unit * 45 - use to set margin or padding to $base-unit * 56 - use to set margin or padding to $base-unit * 6In this example, various margin classes have been applied to render margin on all 4 sides of the pink squares. The margin can be visualized in blue.
<div class="-m2"></div>
<div class="-m4"></div>
<div class="-m6"></div>Apply margin to specific sides of an element by adding t,
b, l, or r to the class name.
<!-- margin-top -->
<div class="-mt3"></div>
<!-- margin-bottom -->
<div class="-mb3"></div>
<!-- margin-left -->
<div class="-ml3"></div>
<!-- margin-right -->
<div class="-mr3"></div>In this example, various padding classes have been applied to render padding on all 4 sides of the pink squares. The padding can be visualized in yellow.
<div class="-p2"></div>
<div class="-p4"></div>
<div class="-p6"></div>Apply padding to specific sides of an element by adding t,
b, l, or r to the class name.
<!-- padding-top -->
<div class="-pt3"></div>
<!-- padding-bottom -->
<div class="-pb3"></div>
<!-- padding-left -->
<div class="-pl3"></div>
<!-- padding-right -->
<div class="-pr3"></div>Apply both margin and padding to an element by adding both class names.
<div class="-m3 -p3"></div>