Display utilities help you quickly show or hide elements on your webpage. They make your page look good on all devices without writing extra CSS.
Display utilities in Bootsrap
class="d-{value} d-{breakpoint}-{value}"
d- controls display like block, inline, none, etc.
{breakpoint} is optional and controls when the display applies (e.g., sm, md, lg, xl, xxl).
<div class="d-none">Hidden on all screens</div>
<div class="d-block d-md-none">Visible only on small screens</div>
<span class="d-inline d-lg-none">Inline on small and medium, hidden on large</span>
<p class="d-flex">Flex container always visible</p>
This page shows four boxes with different display utilities. The first box is hidden everywhere. The second shows only on small screens. The third is inline on small and medium but hidden on large. The last is always visible as a flex container.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Bootstrap Display Utilities Example</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> </head> <body> <main class="container mt-4"> <h1>Display Utilities Demo</h1> <div class="d-none bg-primary text-white p-2 mb-2">Hidden on all screens</div> <div class="d-block d-md-none bg-success text-white p-2 mb-2">Visible only on small screens (block)</div> <div class="d-inline d-lg-none bg-warning text-dark p-2 mb-2">Inline on small/medium, hidden on large</div> <div class="d-flex bg-info text-white p-2 mb-2">Flex container always visible</div> </main> </body> </html>
Use d-none to hide elements completely.
Combine display utilities with breakpoints like d-md-block to control visibility on different screen sizes.
Remember that hidden elements with d-none are removed from the layout and not focusable.
Display utilities let you quickly show or hide elements without writing CSS.
You can control display on different screen sizes using breakpoint classes.
They help make your site responsive and user-friendly on all devices.