-
-
Save grim-reapper/524f07777b2db202e5640f045f9da171 to your computer and use it in GitHub Desktop.
Font Awesome Radio Buttons and Checkboxes
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
| /*Custom Radio Buttons and Checkboxes using Font Awesome*/ | |
| input[type=radio], | |
| input[type='checkbox'] { | |
| display: none; | |
| } | |
| input[type=radio] + label { | |
| display: block; | |
| } | |
| input[type='checkbox'] + label:before, | |
| input[type='radio'] + label:before { | |
| display: inline-block; | |
| font-family: FontAwesome; | |
| font-style: normal; | |
| font-weight: normal; | |
| line-height: 1; | |
| -webkit-font-smoothing: antialiased; | |
| -moz-osx-font-smoothing: grayscale; | |
| padding-right: 8px; | |
| width: 23px; | |
| } | |
| input[type=radio] + label:before { | |
| content: "\f10c"; /* Radio Unchecked */ | |
| } | |
| input[type=radio]:checked + label:before { | |
| content: "\f05d"; /* Radio Checked */ | |
| } | |
| input[type="checkbox"] + label:before { | |
| content: "\f096"; /* Checkbox Unchecked */ | |
| } | |
| input[type="checkbox"]:checked + label:before { | |
| content: "\f046"; /* Checkbox Checked */ | |
| } | |
| .radio label, | |
| .checkbox label { | |
| padding-left: 0; | |
| } | |
| /* | |
| HTML Markup should look like this: | |
| <div class="checkbox"> | |
| <input type="checkbox" id="myCheckbox" name="myCheckbox" value="myCheckbox"> | |
| <label for="myCheckbox">Checkbox Label</label> | |
| </div> | |
| <div class="radio"> | |
| <input type="radio" id="myRadio" name="myRadio" value="myRadioOption"> | |
| <label for="myRadio">Label</label> | |
| </div> | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment