A Pen by Jesús Otero on CodePen.
Last active
August 29, 2015 14:16
-
-
Save jesusoterogomez/91948cd53189119b5ca1 to your computer and use it in GitHub Desktop.
Atomic Switch
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 class="atomic switch" type="checkbox" name="atomic" checked> |
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
body{ | |
background:#222; | |
} | |
.atomic{ | |
&.switch{ | |
display:block; | |
width:54px; | |
height:26px; | |
position:relative; | |
/* display:none; */ | |
visibility:hidden; | |
&:before{ | |
display:block; | |
visibility:visible; | |
content:''; | |
width:100%; | |
border-radius:40px; | |
height:26px; | |
border:3px solid #FFF; | |
transition:all 0.3s ease; | |
} | |
&:after{ | |
display:block; | |
content:''; | |
height:100%; | |
width:50%; | |
background:#FFF; | |
position:absolute; | |
visibility:visible; | |
margin:3px; | |
transform:scale(.75,.75); | |
left:0; | |
top:0; | |
border-radius:50%; | |
transition:all 0.3s ease; | |
} | |
&:checked:after{ | |
left:50%; | |
background:orange; | |
} | |
&:checked:before{ | |
border-color:orange; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment