Display property
Quickly and responsively toggle the display value of elements. Includes support for some of the more common values.
prop
.d
[breakpoint]
-sm
-md
-lg
-xl
value
-none
-inline
-inline-block
-block
-table
-table-cell
-table-row
-flex
-inline-flex
result
.d-inline
Item
.d-inline
Item
Examples
d-inline
d-inline
<div class="d-inline example">d-inline</div> <div class="d-inline examples">d-inline</div>
d-block d-block
<span class="d-block example">d-block</span> <span class="d-block example">d-block</span>
Hiding elements
For faster mobile-friendly development, use responsive display classes for showing and hiding elements by device. Avoid creating entirely different versions of the same site, instead hide element responsively for each screen size.
To hide elements simply use the .d-none
class or one of the .d-{sm,md,lg,xl}-none
classes for any responsive screen variation.
To show an element only on a given interval of screen sizes you can combine one .d-*-none
class with a .d-*-*
class, for example .d-none .d-md-block .d-xl-none
will hide the element for all screen sizes except on medium and large devices.
Screen Size | Class |
---|---|
Hidden on all | .d-none |
Hidden only on xs | .d-none .d-sm-block |
Hidden only on sm | .d-sm-none .d-md-block |
Hidden only on md | .d-md-none .d-lg-block |
Hidden only on lg | .d-lg-none .d-xl-block |
Hidden only on xl | .d-xl-none |
Visible on all | .d-block |
Visible only on xs | .d-block .d-sm-none |
Visible only on sm | .d-none .d-sm-block .d-md-none |
Visible only on md | .d-none .d-md-block .d-lg-none |
Visible only on lg | .d-none .d-lg-block .d-xl-none |
Visible only on xl | .d-none .d-xl-block |
hide on screens wider than lg
hide on screens smaller than lg
<div class="d-lg-none px-1 example">hide on screens wider than lg</div> <div class="d-none d-lg-block px-1 example bg-2">hide on screens smaller than lg</div>