Accessibility CSS Beginner

Add the Screen Reader Text CSS

Add WordPress's standard .screen-reader-text class for themes that are missing it, so hidden labels stay hidden visually but are still read out.

Tested on WordPress 7.1 No plugin needed Updated
style.css 28 lines
.screen-reader-text {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

.screen-reader-text:focus {
	background-color: #fff;
	clip-path: none;
	color: #1d2327;
	display: block;
	font-size: 0.875rem;
	font-weight: 600;
	height: auto;
	left: 5px;
	line-height: normal;
	padding: 15px 23px 14px;
	text-decoration: none;
	top: 5px;
	width: auto;
	z-index: 100000;
}

Where to add this

Recommended Additional CSS Appearance → Customize → Additional CSS, or your page builder's global CSS.
Child theme At the end of your child theme's style.css file.
A code snippets plugin As a CSS snippet set to load on the front end.

WordPress, plugins and many snippets use the screen-reader-text class for text only screen readers should hear, like “(opens in a new tab)” or form labels. If your theme doesn’t define it, that text shows on screen. This CSS adds the standard version.

How it works

The first rule hides the element visually by shrinking it to 1 pixel and clipping it, without display: none, which would hide it from screen readers too.

The second rule shows the element when it receives keyboard focus. That matters for skip links, which should appear when a keyboard user tabs to them.

Things to watch

  • Most themes already include this. Search your theme’s CSS for .screen-reader-text first.
  • If you see doubled skip links or labels after adding it, your theme already had its own version.

How to test it

Add <span class="screen-reader-text">Hidden</span> to a post. It shouldn’t be visible, but a screen reader should read it.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only