How do I make this line visible to the screen reader? <h1…
- User
How do I make this line visible to the screen reader? Website Control Panel I want it to be invisible from the main page
- Assistant
To make the line visible to screen readers while keeping it invisible on the main page, you can use an HTML and CSS technique called "visually hidden" or "off-screen" text. Here's how you can achieve that:
Step 1: Add CSS In your CSS stylesheet or in a style block, add a class to hide the element visually but still make it accessible to screen readers:
.visually-hidden { position: absolute; overflow: hidden; clip: rect(0,0,0,0); height: 1px; width: 1px; white-space: nowrap; }
Step 2: Apply the class to the element Add the
visually-hiddenclass to the<h1>element you want to make accessible to screen readers:Now, when a screen reader reads the page, it will still detect and read the contents of the
<h1>element, but visually, it will remain invisible to users on the main page.