-
-
Save derekjohnson/2853254 to your computer and use it in GitHub Desktop.
Styling radio buttons
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
/** | |
* Styling radio buttons | |
*/ | |
label { | |
display:inline-block; | |
padding: 1em; | |
background: #faf; | |
} | |
[type=radio] { | |
position: absolute; | |
top: -999em; | |
} | |
[type=radio]:checked+label { | |
background: #aff; | |
} | |
[type=radio]:not(:checked)+label { | |
background: #faf; | |
} |
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
<!-- content to be placed inside <body>…</body> --> | |
<body> | |
<input type="radio" id="radio1" name="radio"> | |
<label for="radio1">label</label> | |
<input type="radio" id="radio2" name="radio"> | |
<label for="radio2">label 2</label> | |
<body> |
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
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment