Last active
December 15, 2015 22:29
-
-
Save foo9/5333658 to your computer and use it in GitHub Desktop.
simple checkbox css (webkit only)
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
<form> | |
<input type="checkbox" checked="checked" /> | |
<input type="checkbox" /> | |
</form> |
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
/* webkit only */ | |
input { | |
margin: 0; | |
padding: 0; | |
} | |
input[type="checkbox"], | |
input[type="checkbox"]:before, | |
input[type="checkbox"]:after { | |
border-radius: 8px; | |
-webkit-box-sizing: border-box; | |
} | |
input[type="checkbox"] { | |
position: relative; | |
display: inline-block; | |
overflow: visible; | |
width: 40px; | |
height: 40px; | |
margin: 0; | |
padding: 0; | |
border-radius: 6px; | |
border: 1px solid #222; | |
-webkit-appearance: none; | |
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); | |
background: none; | |
z-index: 3; | |
} | |
input[type="checkbox"]:before, | |
input[type="checkbox"]:after { | |
display: block; | |
width: 38px; | |
height: 38px; | |
position: absolute; | |
top: 0; | |
left: 0; | |
} | |
input[type="checkbox"]:before { | |
content: ""; | |
background: #666; | |
z-index: 2; | |
border-radius: 6px; | |
-webkit-box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.6); | |
box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.6); | |
} | |
input[type="checkbox"]:after { | |
content: "\2714"; | |
font-size: 30px; | |
font-weight: bold; | |
line-height: 38px; | |
text-align: center; | |
color: #888; | |
z-index: 3; | |
text-shadow: -1px -1px 1px rgba(30, 30, 30, 0.5), 1px 1px 1px rgba(200, 200, 200, 0.5); | |
} | |
input[type="checkbox"]:checked:after { | |
color: #00ff00; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment