Skip to content

Sr Only

Content that should be read out, but not shown. The class shrinks the element away visually and leaves it in the document, so screen readers still find it.

A row of “Delete” buttons makes sense to someone looking at the table. Someone listening to it gets four identical buttons. The addition in .lt-sr-only says which row the button belongs to, without repeating it for the eye.

The button is read out as “Delete the application from 4 March”, while it shows “Delete” on screen.

If the label is obvious from the layout, it can be hidden visually. It should not be removed.

placeholder is no replacement for a label: it disappears as soon as the user types, and several screen readers do not read it out at all.

ClassWhat it is
.lt-sr-onlyThe element that should be heard, but not seen

The class has no variables. It has one job, and the values in it are the ones that actually work across browsers.

  • Use it only on text that makes sense read on its own. An explanation that only fits with something you can see becomes confusing when it is read out in a list of links.
  • If the content should go for everyone, use hidden. display: none and visibility: hidden remove the element for screen readers too, and that is exactly what this class avoids.
  • An element with the class can still get focus. If you put a link there, focus jumps to something the user cannot see. If it should be shown when it gets focus, you have to restore the styles in :focus.