Visibility

Use responsive visibility classes to display or hide elements on different devices.

Visibility

Use responsive visibility classes to display or hide elements on different devices.

Usage

Add one of these classes to hide an element.

ClassDescription
.uk-hiddenHides the element on any device. This is more of a legacy class. The recommended way to do this, is to use the hidden attribute.
.uk-invisibleHides the element without removing it from the document flow.
<div hidden></div>

<div class="uk-invisible"></div>

Responsive

This component provides responsive classes to hide or display elements on different viewports.

Hidden

Add one of the .uk-hidden-* classes to hide the element from screens larger than a specified width.

ClassDescription
uk-hidden@sOnly affects device widths of 640px and larger.
uk-hidden@mOnly affects device widths of 960px and larger.
uk-hidden@lOnly affects device widths of 1200px and larger.
uk-hidden@xlOnly affects device widths of 1600px and larger.
<!-- Hidden on tablets and larger -->
<div class="uk-hidden@m"></div>

Note In this example the green elements are hidden on screens that are larger than the defined breakpoint. Resize your browser window to see the effect.


Visible

Use .uk-visible-* classes to show the element for screens larger than the specified width.

ClassDescription
uk-visible@sOnly affects device widths of 640px and larger.
uk-visible@mOnly affects device widths of 960px and larger.
uk-visible@lOnly affects device widths of 1200px and larger.
uk-visible@xlOnly affects device widths of 1600px and larger.
<!-- Visible on tablets and larger -->
<div class="uk-visible@m"></div>

Note In this example the green elements are displayed on screens that are larger than the defined breakpoint. Resize your browser window to see the effect.


Toggle

To display elements on hover or focus only, add the .uk-visible-toggle class to a parent element and one of the following classes to any child elements which should be hidden.

ClassDescription
.uk-hidden-hoverThe element is removed from the document flow when hidden.
.uk-invisible-hoverThe element is not removed from the document flow when hidden.

The child elements will be displayed when the parent element is hovered or focused. Add tabindex="0" to the parent element to allow it to receive focus through keyboard navigation and on touch devices.

If there are a or button elements within the hidden child element, they are already focusable through keyboard navigation and will make the child element appear. Therefore, add tabindex="-1" so the parent element is still focusable on touch devices.

<div class="uk-visible-toggle" tabindex="0">
    <div class="uk-hidden-hover"></div>
</div>

Touch

Add the .uk-hidden-touch class to hide elements on touch devices and the .uk-hidden-notouch to hide elements on devices without a touch screen.

<!-- Hidden on touch devices -->
<div class="uk-hidden-touch"></div>

<!-- Hidden on no-touch devices -->
<div class="uk-hidden-notouch"></div>