Skip to content

Instantly share code, notes, and snippets.

@jasonkmccoy
Created February 18, 2015 22:17
Show Gist options
  • Save jasonkmccoy/727220b1c7b758fff75b to your computer and use it in GitHub Desktop.
Save jasonkmccoy/727220b1c7b758fff75b to your computer and use it in GitHub Desktop.
Hidden Mixins
// Hide from both screenreaders and browsers: h5bp.com/u
// Probably don't use this one
.hidden {
display: none !important;
visibility: hidden;
}
// Hide only visually, but have it available for screenreaders: h5bp.com/v
// Probably use this one
.visually-hidden {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
// Extends the .visuallyhidden class to allow the element to be focusable
// when navigated to via the keyboard: h5bp.com/p
.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
clip: auto;
height: auto;
margin: 0;
overflow: visible;
position: static;
width: auto;
}
// Hide visually and from screenreaders, but maintain layout
// Use this one rarely.
.invisible {
visibility: hidden;
}
@jasonkmccoy
Copy link
Author

Based on _hidden.scss from Mortar
https://github.com/natgeo/mortar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment