Skip to content

Instantly share code, notes, and snippets.

@hulufei
Last active December 15, 2015 22:39
Show Gist options
  • Save hulufei/5334942 to your computer and use it in GitHub Desktop.
Save hulufei/5334942 to your computer and use it in GitHub Desktop.
Custom Radio button background image
/**
* fall back in IE < 9
* Set background alone if using Compass's css sprites, or IE8 will fail
* all background-image styles, for it doesn't support :checked
*/
input[type="radio"] {
display: none;
}
input[type="radio"] + label {
padding-left: 15px;
background-position: url(icon-radio-sprites.png) no-repeat scroll 0 -588px;
}
input[type="radio"]:checked + label {
background-position: 0 -566px;
}
/* IE fall back */
.lt-ie9 {
input[type="radio"] {
display: inline;
}
input[type="radio"] + label {
padding-left: 0;
background: none;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment