Display

Quickly and responsively toggle the display value of components and more with our display utilities. Includes support for some of the more common values, as well as some extras for controlling display when printing.

Display on Bootstrap

Notation

<p>Display utility classes that apply to all breakpoints, from <code>xs </code>to <code>xxl </code>, have no breakpoint abbreviation in them. This is because those classes are applied from <code>min-width: 0;</code>and up, and thus are not bound by a media query. The remaining breakpoints, however, do include a breakpoint abbreviation.</p>
<p class="mt-3">As such, the classes are named using the format:</p>
<ul>
  <li><code>.d-{value} </code> for <code>xs </code></li>
  <li><code>.d-{breakpoint}-{value} </code> for <code> sm</code>,<code> md</code>,<code> lg</code>,<code> xl</code>, and<code> xxl</code>,</li>
</ul>
<p class="mt-3">Where value is one of:</p>
<ul>
  <li><code>none</code></li>
  <li><code>inline</code></li>
  <li><code>inline-block</code></li>
  <li><code>block</code></li>
  <li><code>table</code></li>
  <li><code>table-cell</code></li>
  <li><code>table-row</code></li>
  <li><code>flex</code></li>
  <li><code>inline-flex</code></li>
</ul>
<p>The display values can be altered by changing the <code>$displays </code>variable and recompiling the SCSS.</p>
<p>The media queries affect screen widths with the given breakpoint or larger. For example,<code>.d-lg-none </code>sets <code>display: none;</code>on both <code>lg </code>and <code>xl </code>screens.</p>

Display utility classes that apply to all breakpoints, from xs to xxl , have no breakpoint abbreviation in them. This is because those classes are applied from min-width: 0;and up, and thus are not bound by a media query. The remaining breakpoints, however, do include a breakpoint abbreviation.

As such, the classes are named using the format:

  • .d-{value} for xs
  • .d-{breakpoint}-{value} for sm, md, lg, xl, and xxl,

Where value is one of:

  • none
  • inline
  • inline-block
  • block
  • table
  • table-cell
  • table-row
  • flex
  • inline-flex

The display values can be altered by changing the $displays variable and recompiling the SCSS.

The media queries affect screen widths with the given breakpoint or larger. For example,.d-lg-none sets display: none;on both lg and xl screens.

Example

<div class="d-inline bg-primary p-2 text-white">d-inline</div>
<div class="d-block bg-primary p-2 text-white mt-3">d-block</div>
d-inline
d-block

Hiding Elements

<p>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 elements responsively for each screen size.</p>
<p>To hide elements simply use the<code>.d-none </code>class or one of the<code>.d-{sm,md,lg,xl,xxl}-none </code>classes for any responsive screen variation.</p>
<p>To show an element only on a given interval of screen sizes you can combine one<code>.d-*-none class with a</code><code>.d-*-* class, for example</code><code>.d-none .d-md-block .d-xl-none </code>will hide the element for all screen sizes except on medium and large devices.</p>
<table class="table table-bordered">
  <thead>
    <tr>
      <th class="ps-2">Screen Size</th>
      <th>Class</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td class="ps-2">Hidden on all</td>
      <td><code>.d-none</code></td>
    </tr>
    <tr>
      <td class="ps-2">Hidden only on xs</td>
      <td><code>.d-none .d-sm-block</code></td>
    </tr>
    <tr>
      <td class="ps-2">Hidden only on sm</td>
      <td><code>.d-sm-none .d-md-block</code></td>
    </tr>
    <tr>
      <td class="ps-2">Hidden only on md</td>
      <td><code>.d-md-none .d-lg-block</code></td>
    </tr>
    <tr>
      <td class="ps-2">Hidden only on lg</td>
      <td><code>.d-lg-none .d-xl-block</code></td>
    </tr>
    <tr>
      <td class="ps-2">Hidden only on xl</td>
      <td><code>.d-xl-none</code></td>
    </tr>
    <tr>
      <td class="ps-2">Visible on all</td>
      <td><code>.d-block</code></td>
    </tr>
    <tr>
      <td class="ps-2">Visible only on xs</td>
      <td><code>.d-block .d-sm-none</code></td>
    </tr>
    <tr>
      <td class="ps-2">Visible only on sm</td>
      <td><code>.d-none .d-sm-block .d-md-none</code></td>
    </tr>
    <tr>
      <td class="ps-2">Visible only on md</td>
      <td><code>.d-none .d-md-block .d-lg-none</code></td>
    </tr>
    <tr>
      <td class="ps-2">Visible only on lg</td>
      <td><code>.d-none .d-lg-block .d-xl-none</code></td>
    </tr>
    <tr>
      <td class="ps-2">Visible only on xl</td>
      <td><code>.d-none .d-xl-block</code></td>
    </tr>
  </tbody>
</table>

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 elements responsively for each screen size.

To hide elements simply use the.d-none class or one of the.d-{sm,md,lg,xl,xxl}-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

Display in Prints

Change the display value of elements when printing with our print display utility classes. Includes support for the same display values as our responsive .d-* utilities.

  • .d-print-none
  • .d-print-inline
  • .d-print-inline-block
  • .d-print-block
  • .d-print-table
  • .d-print-table-row
  • .d-print-table-cell
  • .d-print-flex
  • .d-print-inline-flex

The print and display classes can be combined.

<div class="d-print-none">Screen Only (Hide on print only)</div>
<div class="d-none d-print-block">Print Only (Hide on screen only)</div>
<div class="d-none d-lg-block d-print-block">Hide up to large on screen, but always show on print</div>
Screen Only (Hide on print only)
Print Only (Hide on screen only)
Hide up to large on screen, but always show on print

Thank you for creating with Phoenix|
2023 ©Themewagon

v1.12.0

Theme Customizer

Explore different styles according to your preferences

Color Scheme
RTL

Change text direction

Support Chat

Toggle support chat

Navigation Type
Vertical Navbar Appearance
Horizontal Navbar Shape
Horizontal Navbar Appearance
Purchase template
customize