Last active
December 15, 2015 22:39
-
-
Save hulufei/5334942 to your computer and use it in GitHub Desktop.
Custom Radio button background image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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