Last active
December 22, 2015 23:49
-
-
Save pwartbichler/6549745 to your computer and use it in GitHub Desktop.
CSS Styling for Checkboxes/Radio Buttons, works for IE9+
Look at the example: http://jsbin.com/AQoVENa/5/edit?html,css,output
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
| input[type="checkbox"] { | |
| position: absolute; | |
| overflow: hidden; | |
| clip: rect(0 0 0 0); | |
| height: 1px; | |
| width: 1px; | |
| margin: -1px; | |
| padding: 0; | |
| border: 0; | |
| } | |
| input[type="checkbox"] + label { | |
| position: relative; | |
| } | |
| input[type="checkbox"]:focus + label { | |
| outline: 1px solid orange; | |
| } | |
| input[type="checkbox"] + label span.checkbox { | |
| display: inline-block; | |
| width: 15px; | |
| height: 15px; | |
| background: orange; | |
| cursor: pointer; | |
| position: absolute; | |
| } | |
| input[type="checkbox"] + label span.labeltext { | |
| padding: 0 0 0 20px; | |
| } | |
| input[type="checkbox"]:checked + label span.checkbox { | |
| background: green; | |
| } |
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
| <input id="abc" type="checkbox" value="" /> | |
| <label for="abc"> | |
| <span class="checkbox"></span> | |
| <span class="labeltext">Labeltext</span> | |
| </label> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment