Bootstrap padding classes can assign to an element or subsets of its sides.These Classes are madfe from a default Sass map ranging from .25rem to 3rem.
Bootstrap provides various shorthands for responsive margin and padding sizing.
Simply We can apply classes to add margins and padding for better design.
The class value method like following {property}{sides}-{size} for xs and {property}{sides}-{breakpoint}-{size} for other breakpoints.
Bootstrap property is one of: m for margin and p for padding
Change the properties depends on the device for better responsive mt-sm-, mt-md-, mt-xl-, mt-xxl-
sides is one of:
t – for margin-top or padding-top
margin-top classes
.mt-0{margin-top:0!important}
.mt-1{margin-top:.25rem!important}
.mt-2{margin-top:.5rem!important}
.mt-3{margin-top:1rem!important}
.mt-4{margin-top:1.5rem!important}
.mt-5{margin-top:3rem!important}
.mt-auto{margin-top:auto!important}
Padding top classes
.pt-0{padding-top:0!important}
.pt-1{padding-top:.25rem!important}
.pt-2{padding-top:.5rem!important}
.pt-3{padding-top:1rem!important}
.pt-4{padding-top:1.5rem!important}
.pt-5{padding-top:3rem!important}
b – for margin-bottom or padding-bottom
Margin Bottom Classes
.mb-0{margin-bottom:0!important}
.mb-1{margin-bottom:.25rem!important}
.mb-2{margin-bottom:.5rem!important}
.mb-3{margin-bottom:1rem!important}
.mb-4{margin-bottom:1.5rem!important}
.mb-5{margin-bottom:3rem!important}
.mb-auto{margin-bottom:auto!important}
Padding Bottom Classes
.pb-0{padding-bottom:0!important}
.pb-1{padding-bottom:.25rem!important}
.pb-2{padding-bottom:.5rem!important}
.pb-3{padding-bottom:1rem!important}
.pb-4{padding-bottom:1.5rem!important}
.pb-5{padding-bottom:3rem!important}
s – for start or padding-left
Margin Left Classes
.ms-0{margin-left:0!important}
.ms-1{margin-left:.25rem!important}
.ms-2{margin-left:.5rem!important}
.ms-3{margin-left:1rem!important}
.ms-4{margin-left:1.5rem!important}
.ms-5{margin-left:3rem!important}
.ms-auto{margin-left:auto!important}
Padding Left Classes
.ps-0{padding-left:0!important}
.ps-1{padding-left:.25rem!important}
.ps-2{padding-left:.5rem!important}
.ps-3{padding-left:1rem!important}
.ps-4{padding-left:1.5rem!important}
.ps-5{padding-left:3rem!important}
e – for margin-right or padding-right
Margin Right Classes
.me-1{margin-right:.25rem!important}
.me-2{margin-right:.5rem!important}
.me-3{margin-right:1rem!important}
.me-4{margin-right:1.5rem!important}
.me-5{margin-right:3rem!important}
.me-auto{margin-right:auto!important}
Padding Right Classes
.pe-0{padding-right:0!important}
.pe-1{padding-right:.25rem!important}
.pe-2{padding-right:.5rem!important}
.pe-3{padding-right:1rem!important}
.pe-4{padding-right:1.5rem!important}
x – for both *-left and *-right
y – for both *-top and *-bottom
blank — for classes that set a margin or padding on all 4 sides of the element
size is one of:
m-0 – for classes that eliminate the margin or padding by setting it to 0
1 – (by default) for classes that set the margin or padding to $spacer * .25
2 – (by default) for classes that set the margin or padding to $spacer * .5
3 – (by default) for classes that set the margin or padding to $spacer
4 – (by default) for classes that set the margin or padding to $spacer * 1.5
5 – (by default) for classes that set the margin or padding to $spacer * 3
auto – for classes that set the margin to auto