Forked from CSS only Custom Radio Buttons.
Last active
August 29, 2015 14:20
-
-
Save teeparham/20d522e696940897c339 to your computer and use it in GitHub Desktop.
CSS only Custom 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
<div> | |
<input type="radio" id="radio01" name="radio" /> | |
<label for="radio01"><span></span>Radio Button 1</label> | |
</div> | |
<div> | |
<input type="radio" id="radio02" name="radio" /> | |
<label for="radio02"><span></span>Radio Button 2</label> | |
</div> |
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
@import "compass/css3"; | |
$text: black; | |
$shadow: #cccccc; | |
$outline: #ffffff; | |
$selected: #CC3300; | |
$unselected: #cccccc; | |
div { | |
margin: 0 0 0.75em 0; | |
} | |
input[type="radio"] { | |
display: none; | |
} | |
input[type="radio"] + label { | |
color: $text; | |
font-family: Arial, sans-serif; | |
font-size: 16px; | |
} | |
input[type="radio"] + label span { | |
box-shadow: 0 0 0 2px $shadow; | |
display: inline-block; | |
width: 24px; | |
height: 24px; | |
margin: -1px 7px 0 0; | |
vertical-align: middle; | |
cursor: pointer; | |
border-radius: 50%; | |
} | |
input[type="radio"] + label span { | |
border: 8px solid $outline; | |
background-color: $unselected; | |
} | |
input[type="radio"]:checked + label span{ | |
background-color: $selected; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment