Skip to content

Instantly share code, notes, and snippets.

@FernandoCutire
Last active July 18, 2024 18:56
Show Gist options
  • Save FernandoCutire/58efc2db1e52f5f1703c68ea11075626 to your computer and use it in GitHub Desktop.
Save FernandoCutire/58efc2db1e52f5f1703c68ea11075626 to your computer and use it in GitHub Desktop.
Hides an element completely (visually and positionally) in the DOM while still allowing it to be accessible. - Remove all borders and padding and hide the element's overflow. Use clip to define that no part of the element is shown. Make the heig
.offscreen {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
<a class="button" href="https://google.com">
Learn More <span class="offscreen"> about pants</span>
</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment