Spacing utility classes
Bootstrap 4 adds a new set of utility classes called spacing utility classes. These classes allow you to quickly add spacing in any direction of an element via margin or padding.
The format of these classes is [margin or padding]-[direction]-[size]
.
For margin or padding, use the following:
m
for marginp
for padding
For direction, you can use these:
a
for allt
for topr
for rightl
for leftb
for bottomx
for left and righty
for top and bottom
You can use these for sizes:
0
for zero1
for1rem
2
for1.5rem
3
for3rem
Here is an example to demonstrate the spacing utility classes. Place this code at the end of the container element of index.html
:
<hr> <div class="row"> <div class="col-xs-12 m-t-2"> <p> Lorem ipsum dolor sit amet, at suscipit sodales eget ante ultricies mauris. Etiam dolor felis morbi nibh, mollit porttitor tempor, dignissim magna pellentesque dictumst bibendum dictum integer. Justo mattis dapibus in diam. Quis arcu...