gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
How do I add text that is readable by the screenreader but invisible to users
- User
How do I add text that is readable by the screenreader but invisible to users
- Assistant
To add text that is readable by screen readers but invisible to users, you can use the following methods:
-
Using CSS:
- Add a class or id to the element that you want to make invisible.
- Apply CSS styles to the class or id to hide it, such as:
.sr-only { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; } - Apply this class or id to the element in your HTML markup.
-
Using HTML attributes:
- Add the
hiddenattribute to the element you want to hide. - However, this may not work in all cases as the hidden attribute is not always picked up by all screen readers.
- Add the
-
Using ARIA attributes:
- Add the
aria-hidden="true"attribute to the element you want to make invisible.
- Add the
-