Visibility
Set the visibility of elements with our visibility utilities. These utility classes do not modify the display value at all and do not affect layout – .invisible elements still take up space in the page.
Elements with the .invisible class will be hidden both visually and for assistive
technology/screen reader users.
Apply .visible or .invisible as needed.
<div class="visible">...</div>
<div class="invisible">...</div>
// Class
.visible {
visibility: visible !important;
}
.invisible {
visibility: hidden !important;
}
Visually hide an element while still allowing it to be exposed to assistive technologies (such as screen readers) with .visually-hidden. Use .visually-hidden-focusable to visually hide an element by default, but to display it when it’s focused (e.g. by a keyboard-only user). .visually-hidden-focusable can also be applied to a container–thanks to :focus-within, the container will be displayed when any child element of the container receives focus.
<div> <h2 className="visually-hidden">Title for screen readers</h2> <a className="visually-hidden-focusable" href="#content"> Skip to main content </a> <div className="visually-hidden-focusable"> A container with a <a href="#">focusable element</a>. </div> </div>
Both visually-hidden and visually-hidden-focusable can also be used as mixins.
// Usage as a mixin
.visually-hidden-title {
@include visually-hidden;
}
.skip-navigation {
@include visually-hidden-focusable;
}