A Pen by Juan Cabrera on CodePen.
Created
March 25, 2016 09:48
-
-
Save estebanrfp/b2812b487880a75f8608 to your computer and use it in GitHub Desktop.
Simple styled checkbox
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
input type="checkbox" id="chk" | |
label for="chk" click this styled checkbox |
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
$green: #22b573; | |
$grey: #555; | |
$transitionSpeed: 200ms; | |
input[type="checkbox"] + label { | |
position: absolute; | |
width: 60px; | |
height: 60px; | |
border: 10px solid $grey; | |
border-radius: 100%; | |
top: 50%; | |
left: 10%; | |
transform: translate(-50%, -50%); | |
transition: all ease-out $transitionSpeed; | |
text-indent: 90px; | |
font: normal normal 30px/60px "Helvetica"; | |
white-space: nowrap; | |
color: $grey; | |
user-select: none; | |
&:after { | |
content: ""; | |
position: absolute; | |
width: 0px; | |
height: 25px; | |
border-bottom: 10px solid $green; | |
border-left: 10px solid $green; | |
top: 25%; | |
left: 50%; | |
transform-origin: bottom left; | |
transform: rotate(-45deg); | |
opacity: 0; | |
transition: all ease-out $transitionSpeed; | |
} | |
} | |
input[type="checkbox"]:checked + label { | |
border: 10px solid $green; | |
&:after { | |
opacity: 1; | |
width: 70px; | |
} | |
} | |
#chk { | |
display: none; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment