Skip to content

Instantly share code, notes, and snippets.

@iamnewton
Created January 16, 2014 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamnewton/8460357 to your computer and use it in GitHub Desktop.
Save iamnewton/8460357 to your computer and use it in GitHub Desktop.
7 CSS Snippets from HTML5 Boilerplate
html {
/* ensures scrollbar always appears */
overflow-y: scroll;
/* prevents mobile browsers from adjusting page font */
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
font-size: 100%;
}
::selection {
background-color: rgb(254,87,161);
color: rgb(255,255,255);
}
img {
/* assists IE7 in scaling images */
-ms-interpolation-mode: bicubic;
}
/* Hide only visually, but have it available for screenreaders: h5bp.com/v */
.visuallyhidden {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(0 0 0 0);
margin: -1px;
border: 0;
padding: 0;
}
/* Extends the .visuallyhidden class to allow the element to be focusable when navigated to via the keyboard: h5bp.com/p */
.visuallyhidden.focusable:active,
.visuallyhidden.focusable:focus {
position: static;
width: auto;
height: auto;
overflow: visible;
clip: auto;
margin: 0;
}
/* Bug fix for SVG support in IE9 */
svg:not(:root) {
overflow: hidden;
}
@media print {
/* ensures that no images reach the outer bounds of the normal page view */
img {
max-width: 100% !important;
}
/* prevents widows and orphans on heading and paragraph tags */
h2,
h3,
p, {
orphans: 3;
widows: 3;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment