Margins and padding
Bootstrap also provides handy classes for centering and floating elements.
Bootstrap 3 had acenter-blockclass, which used margins to align an element centrally and set thedisplayproperty toblock. This has been removed from Bootstrap 4 in favor of two other classes:d-blockandmx-auto. As already noted earlier, the d-blockclass is responsible for setting the element'sdisplayproperty toblock, while themx-autoclass sets the margin properties toauto. Similarly, the mt-auto, mr-auto, ml-auto, and mb-auto classes set the margin-top, margin-right, margin-left, and margin-bottom properties to auto respectively (the classes are defined in _spacing.scss):
.m-auto {
margin: auto !important;
}
.mt-auto {
margin-top: auto !important;
}
.mr-auto {
margin-right: auto !important;
}
.mb-auto {
margin-bottom: auto !important;
}
.ml-auto {
margin-left: auto !important;
}
.mx-auto {
margin-right: auto !important;
margin-left: auto !important;
}
.my-auto...