A Pen by Rab Rennie on CodePen.
Created
April 29, 2018 08:05
-
-
Save CodeMyUI/2ac006b5918c613b4348b210cb3ee826 to your computer and use it in GitHub Desktop.
input #002 - 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
.checkbox-container | |
input(type="checkbox" id="rememberMe") | |
label(for="rememberMe" class="checkbox") | |
label(for="rememberMe") Remember me? | |
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
.checkbox-container { | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
input[type="checkbox"] { | |
display: none; | |
} | |
label { | |
cursor: pointer; | |
} | |
} | |
.checkbox-container .checkbox { | |
display: inline-block; | |
width: 15px; | |
height: 15px; | |
background: #d0d0d0; | |
&:after { | |
content: ""; | |
position: absolute; | |
width: 0px; | |
height: 3px; | |
background: #3498db; | |
transform:translate(4px, 11px) rotate(-45deg); | |
transform-origin: left; | |
transition: all 150ms; | |
transition-delay: 0ms; | |
} | |
&:before { | |
content: ""; | |
position: absolute; | |
width: 0px; | |
height: 3px; | |
background: #3498db; | |
transform:translate(1px, 6px) rotate(45deg); | |
transform-origin: left; | |
transition: all 150ms; | |
transition-delay: 150ms; | |
} | |
} | |
.checkbox-container input[type="checkbox"]:checked { | |
& ~ .checkbox { | |
&:before { | |
width: 7px; | |
transition-delay: 0ms; | |
} | |
&:after { | |
width: 13px; | |
transition-delay: 150ms; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment