Created
July 18, 2013 16:14
-
-
Save russgossett/6030669 to your computer and use it in GitHub Desktop.
Custom Checkboxes
This file contains 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
body { | |
background: #fff; | |
} | |
input[type=checkbox] { | |
visibility: hidden; | |
} | |
/* SQUARED GRAY */ | |
.squaredGray { | |
width: 20px; | |
margin: 20px auto; | |
position: relative; | |
} | |
.squaredGray label { | |
cursor: pointer; | |
position: absolute; | |
width: 20px; | |
height: 20px; | |
top: 0; | |
border-radius: 4px; | |
-webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5); | |
-moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5); | |
box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5); | |
background: #fcfff4; | |
background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); | |
background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); | |
background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); | |
background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); | |
background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); | |
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 ); | |
} | |
.squaredGray label:after { | |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; | |
filter: alpha(opacity=0); | |
opacity: 0; | |
content: ''; | |
position: absolute; | |
width: 9px; | |
height: 5px; | |
background: transparent; | |
top: 4px; | |
left: 4px; | |
border: 3px solid #333; | |
border-top: none; | |
border-right: none; | |
-webkit-transform: rotate(-45deg); | |
-moz-transform: rotate(-45deg); | |
-o-transform: rotate(-45deg); | |
-ms-transform: rotate(-45deg); | |
transform: rotate(-45deg); | |
} | |
.squaredGray label:hover::after { | |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"; | |
filter: alpha(opacity=30); | |
opacity: 0.5; | |
} | |
.squaredGray input[type=checkbox]:checked + label:after { | |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; | |
filter: alpha(opacity=100); | |
opacity: 1; | |
} | |
/* SQUARED BLUE */ | |
.squaredBlue { | |
width: 20px; | |
margin: 20px auto; | |
position: relative; | |
} | |
.squaredBlue label { | |
cursor: pointer; | |
position: absolute; | |
width: 20px; | |
height: 20px; | |
top: 0; | |
border-radius: 2px; | |
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,.4); | |
background:#06C; | |
} | |
.squaredBlue label:after { | |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; | |
filter: alpha(opacity=0); | |
opacity: 0; | |
content: ''; | |
position: absolute; | |
width: 9px; | |
height: 5px; | |
background: transparent; | |
top: 4px; | |
left: 4px; | |
border: 3px solid #fff; | |
border-top: none; | |
border-right: none; | |
-webkit-transform: rotate(-45deg); | |
-moz-transform: rotate(-45deg); | |
-o-transform: rotate(-45deg); | |
-ms-transform: rotate(-45deg); | |
transform: rotate(-45deg); | |
} | |
.squaredBlue label:hover::after { | |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"; | |
filter: alpha(opacity=30); | |
opacity: 0.3; | |
} | |
.squaredBlue input[type=checkbox]:checked + label:after { | |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; | |
filter: alpha(opacity=100); | |
opacity: 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment