Utilities for layout
Bootstrap 5 Utilities for layout
To speed up the creation of mobile-friendly and responsive elements, Bootstrap includes dozens of utility classes for showing, hiding, aligning, and spacing content.
Use display utilities
for responsively toggling common values of the
display property. You can combine them with grid system,
content, or components to show or hide them across specific viewports.
MDBootstrap is built with flexbox, but not every element’s
display has been changed to
display: flex as this would add many
unnecessary overrides and unexpectedly change key browser behaviors. Most of
are built with flexbox enabled.
Should you need to add
display: flex to an element, do so with
.d-flex or one of the responsive variants (e.g.,
need this class or
display value to allow the use of our extra
utilities for sizing, alignment, spacing, and more.
Margin and padding
to control how elements and components are spaced and sized. Bootstrap includes a six-level
scale for spacing utilities, based on a
1rem value default
$spacer variable. Choose values for all viewports (e.g.,
margin-right: 1rem), or pick responsive variants to target specific viewports
margin-right: 1rem starting at the
display isn’t needed, you can toggle the
an element with our
visibility utilities. Invisible elements will still affect the layout of the page, but are visually hidden from