Sometimes building a perfectly scaling layout isn't enough. You often need to build UI components that exclusively exist on massive Desktop monitors, and entirely different buttons that only trigger on tiny mobile phone screens!
Warning for migrating developers: In older versions (like Bootstrap 3 or 4), you might mechanically use classes like .hidden-xs or .visible-md. Bootstrap 5 completely deleted these classes! Instead, Bootstrap 5 handles everything smoothly through powerful Display utilities combined directly with Breakpoints.
If you have a massive, complex navigation sidebar or a gigantic hero image that you definitively want to strictly hide from view on cellphones to save screen-estate, you must follow the Mobile-First protocol aggressively!
First, you forcefully delete it natively by applying .d-none. Then, you tell the browser to explicitly reactivate the block right when the screen becomes a Tablet (or Desktop) by subsequently chaining .d-md-block!
<!-- Default to hidden (.d-none), but reactivate as a block purely on Medium monitors (.d-md-block) -->
<div class="d-none d-md-block">
Only Desktop users have the layout space to handle this heavy graphic!
</div>
What if you want to build a specialized "Click here to call us!" button that should natively only ever appear for explicit mobile phone users?
Again, apply Mobile-First logic! You simply leave the element normally visible structurally by default. Then, you aggressively demand the browser to violently hide it exactly when the screen gets too large by explicitly attaching the .d-md-none utility!
<!-- Button is visible organically by default, but actively vanishes smoothly when on iPads or Desktops! -->
<button class="btn btn-success d-md-none">Specifically for Phones!</button>
Sometimes, users attempt to literally physically print out your application pages onto paper! Bootstrap also uniquely provides .d-print-none to cleanly strip off ugly Website Navigation Bars or Video embeds strictly specifically when your web document is actively being physically printed!
<!-- Sits flawlessly safely onscreen normally, but magically disappears if the user prints the HTML page! -->
<nav class="navbar d-print-none">...</nav>