2016-09-09 06:48:17 +02:00
---
layout: docs
2019-02-07 10:29:06 +01:00
title: Screen readers
description: Use screen reader utilities to hide elements on all devices except screen readers.
2019-05-23 11:56:03 +02:00
group: helpers
2016-09-09 06:48:17 +02:00
---
2019-05-20 10:03:51 +02:00
Hide an element to all devices **except screen readers** with `.sr-only` . Use `.sr-only-focusable` to show the element only when it's focused (e.g. by a keyboard-only user). Can also be used as mixins.
2016-09-09 06:48:17 +02:00
2019-01-08 17:33:28 +01:00
{{< example > }}
2019-05-20 10:03:51 +02:00
< h2 class = "sr-only" > Title for screen readers< / h2 >
< a class = "sr-only-focusable" href = "#content" > Skip to main content< / a >
2019-01-08 17:33:28 +01:00
{{< / example > }}
2016-09-09 06:48:17 +02:00
2019-01-08 17:33:28 +01:00
{{< highlight scss > }}
2016-09-09 06:48:17 +02:00
// Usage as a mixin
2019-05-20 10:03:51 +02:00
.sr-only-title {
2016-09-09 06:48:17 +02:00
@include sr-only;
2019-05-20 10:03:51 +02:00
}
.skip-navigation {
2016-09-09 06:48:17 +02:00
@include sr-only-focusable;
}
2019-01-08 17:33:28 +01:00
{{< / highlight > }}