Display

Toggle the display value of components and more with our display utilities. Includes responsive support.

Syntax

Use .d-{value} to set an element’s display value at every viewport width. Add a breakpoint with .d-{breakpoint}-{value} to change it from that width upward.

HTML
<div class="d-block d-md-flex gap-2">
	<div>Project overview</div>
	<div>Updated today</div>
</div>

Use Flex for direction, alignment and wrapping after enabling a flex container. Use Grid for grid layouts.

Class reference

The display utility generates the following values, each with the same responsive variants.

Class Effect
.d-none Removes the element and its descendants from layout and the accessibility tree.
.d-block Creates a block box that starts on a new line.
.d-inline Flows with surrounding text as an inline box.
.d-inline-block Flows inline while allowing an explicit width and height.
.d-flex Creates a block flex container for its direct children.
.d-inline-flex Creates an inline flex container for its direct children.

Responsive behavior

All six values support sm, md, lg, xl and xxl, for example .d-lg-inline-flex. Responsive rules use minimum widths and remain active at larger sizes. See Breakpoints for the default widths and Sass configuration.

When several display utilities match, the utility for the later breakpoint takes precedence, regardless of class order in the HTML. For example, .d-none d-md-flex d-lg-none is hidden below md, flex from md up to lg, and hidden again from lg upward.

Choose one base display value and at most one display value per breakpoint on an element.

Native hidden states

The native hidden attribute remains hidden even when an element also uses a component or display utility class. Remove the attribute when revealing that element; adding .d-block or .d-flex does not override it. Use hidden="until-found" when content should remain discoverable through browser find-in-page behavior in supporting browsers, and avoid .d-none on that content.

HTML
<div class="alert" hidden>Hidden alert</div>
<div class="d-flex" hidden>Hidden flex content</div>
<div hidden="until-found">Findable content</div>

Use .d-none for responsive visibility, and native hidden for content whose visibility is controlled by application state. Both hide content from assistive technology while hidden. Keep essential instructions available at every viewport width.

Practical recipes

Show content within a breakpoint range

Keep a compact summary below md and show details only between md and lg. Each visible element retains its own display value.

3 active projects
3 active projects · 2 updates today
HTML
<div class="d-flex d-md-none">3 active projects</div>
<div class="d-none d-md-flex d-lg-none">3 active projects · 2 updates today</div>

Keep a status badge inline

Use .d-inline-flex to align a badge and its description within surrounding text. The flex utilities align the contents, while the display utility keeps the container inline.

Deployment status: Ready All checks passed

HTML
<p>
	Deployment status:
	<span class="d-inline-flex align-items-center gap-2">
		<span class="badge bg-success">Ready</span>
		<span>All checks passed</span>
	</span>
</p>