v6.0.0-beta.16
  • Home
  • Principles
  • Tokens
  • Global
  • Layout
  • Components
  • Utilities
    • Click Area
    • Container
    • Counted
    • Indexed
    • Layout Items
    • No Print
    • Typography
    • Visually Hidden
    • Z-Index
  • home
  • /
  • utilities
  • /
  • Visually Hidden
Source

Visually Hidden

The Visually Hidden utilities hide elements visually while keeping them accessible to screen readers and other assistive technologies. These utilities are essential for creating accessible interfaces where you need to provide information for screen reader users without affecting the visual design.

Usage

Apply .visually-hidden or .sr-only to elements that should be available to assistive technologies but hidden from visual users.

<h1>Page Title</h1>

<button>
  <span class="visually-hidden">Close dialog</span>
  <svg aria-hidden="true"><!-- close icon --></svg>
</button>

<div class="sr-only">Screen reader only instructions</div>

The utilities ensure that hidden content remains in the accessibility tree while being completely invisible to sighted users, maintaining proper focus order and keyboard navigation.

Class Patterns

Pattern Description
.visually-hidden Hides element visually but keeps it accessible to screen readers
.sr-only Alternative name for visually-hidden (screen reader only)
← utilities: Typography utilities: Z-Index →
© crinkles
Powered by: 11ty & Feo.css | Github