A NSW Government website
Design System v3.16.0

Display

Utilities for controlling the display box type of an element.

Change the value of the display property with our responsive display utility classes. Classes can be combined for various effects as you need.

Notation

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:

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

Where value is one of:

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

Examples

When controlling the flow of text, using the CSS property display: inline will cause the text inside the element to wrap normally.

While using the property display: inline-block will wrap the element to prevent the text inside from extending beyond its parent.

Lastly, using the property display: block will put the element on its own line and fill its parent.

Hiding elements

To hide an element and remove it from the page layout (compare with .nsw-invisible from the visibility documentation) use the .nsw-display-none class or one of the .nsw-display-{sm,md,lg,xl,xxl}-none classes for any responsive screen variation.

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 show an element only on a given interval of screen sizes you can combine one .nsw-display-*-none class with a .nsw-display-*-* class, for example .nsw-display-none .nsw-display-md-block .nsw-display-xl-none .nsw-display-xxl-none will hide the element for all screen sizes except on medium and large devices.

Screen size Class
Hidden on all .nsw-display-none
Hidden only on xs .nsw-display-none .nsw-display-sm-block
Hidden only on sm .nsw-display-sm-none .nsw-display-md-block
Hidden only on md .nsw-display-md-none .nsw-display-lg-block
Hidden only on lg .nsw-display-lg-none .nsw-display-xl-block
Hidden only on xl .nsw-display-xl-none .nsw-display-xxl-block
Hidden only on xxl .nsw-display-xxl-none
Visible on all .nsw-display-block
Visible only on xs .nsw-display-block .nsw-display-sm-none
Visible only on sm .nsw-display-none .nsw-display-sm-block .nsw-display-md-none
Visible only on md .nsw-display-none .nsw-display-md-block .nsw-display-lg-none
Visible only on lg .nsw-display-none .nsw-display-lg-block .nsw-display-xl-none
Visible only on xl .nsw-display-none .nsw-display-xl-block .nsw-display-xxl-none
Visible only on xxl .nsw-display-none .nsw-display-xxl-block
hide on lg and wider screens
hide on screens smaller than lg