Utility Classes
Beyond components, Bootstrap ships hundreds of small, single-purpose classes for spacing, flexbox layout, and display — the kind of tiny adjustments that used to mean writing a one-off CSS rule for every tweak.
The spacing scale
Margin and padding utilities follow a pattern: {property}{sides}-{size}. m is margin, p is padding; t/b/s/e/x/y pick a side (start/end respect left-to-right vs right-to-left languages automatically); sizes run 0 through 5 on a consistent scale:
<div class="mt-4 mb-2 px-3">Spaced box</div> <div class="p-0">No padding at all</div> <div class="p-5">Maximum padding</div>
mt-4 is margin-top step 4, mb-2 is margin-bottom step 2, and px-3 is padding-left-and-right (x-axis) step 3 — the same scale and letters work identically for both margin and padding.
Flexbox utilities
<div class="d-flex justify-content-between align-items-center"> <span>Left</span> <span>Right</span> </div>
d-flex turns on flexbox for that element, justify-content-between pushes children to the far ends with space between them, and align-items-center centers them vertically — this exact trio is one of the most common patterns in real Bootstrap layouts (think: a title on the left, a button on the right, same row).
Display and visibility
<p class="d-none d-md-block">Only visible on medium screens and up</p>
d-none hides an element completely (display: none); d-md-block overrides that back to visible starting at the md breakpoint. This combination — hide by default, show from a breakpoint up (or the reverse) — is the standard way to show different content to mobile vs desktop visitors.