Generate visually hidden text for screen readers (sr-only)
Skip link that becomes visible when focused, allowing keyboard users to skip navigation
<a href="#main-content" class="sr-only sr-only-focusable">
Skip to main content
</a>
<!-- Later in the page -->
<main id="main-content" tabindex="-1">
<!-- Main content -->
</main>.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
.sr-only-focusable:focus {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto;
white-space: normal;
padding: 1rem;
background: #000;
color: #fff;
z-index: 9999;
}<!-- Icon button -->
<button type="submit">
<svg aria-hidden="true">...</svg>
<span class="sr-only">Submit form</span>
</button>.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}<!-- Status update -->
<div role="status" aria-live="polite">
<span class="sr-only">3 new messages</span>
</div>
<!-- Error alert -->
<div role="alert" aria-live="assertive">
<span class="sr-only">Error: Form submission failed</span>
</div><!-- Required field -->
<label for="name">
Name
<span class="sr-only">(required)</span>
<abbr title="required" aria-hidden="true">*</abbr>
</label>
<!-- External link -->
<a href="https://example.com" target="_blank">
Visit Example
<span class="sr-only">(opens in new window)</span>
</a>Help others discover this tool!