.demo
.demo__title Checkboxes
.demo__content
label.switcher
input(type="checkbox")
.switcher__indicator
span Normal
br
br
label.switcher
input(type="checkbox" checked)
.switcher__indicator
span Checked
br
br
label.switcher
input(type="checkbox" disabled)
.switcher__indicator
span Disabled
br
br
label.switcher
input(type="checkbox" disabled checked)
.switcher__indicator
span Disabled
View Compiled
@import url(https://fonts.googleapis.com/css?family=Raleway:400,300,700);
html {
background: #29ce9a;
font-family: Raleway;
display: table;
width: 100%;
height: 100%;
}
body {
display: table-cell;
vertical-align: middle;
text-align: center;
}
.demo {
display: inline-block;
padding: 50px;
background-color: #fff;
border-radius: 20px;
color: #666;
text-align: center;
}
.demo__content {
text-align: left;
display: inline-block;
}
.demo__title {
font-size: 50px;
font-weight: bold;
text-transform: uppercase;
padding-bottom: 30px;
}
.switcher {
position: relative;
display: inline-block;
cursor: pointer;
padding-left: 100px;
height: 40px;
line-height: 40px;
margin: 5px;
font-size: 30px;
user-select: none;
input {
display: none;
}
}
.switcher__indicator {
&::after {
content: '';
position: absolute;
top: 0;
left: 0;
height: 40px;
width: 40px;
background-color: #d5d5d5;
border-radius: 50%;
transition: all .3s ease;
animation-name: pulsein;
animation-duration: .3s;
}
&::before {
content: '';
position: absolute;
top: 16px;
left: 0;
width: 80px;
height: 8px;
background-color: #d5d5d5;
border-radius: 10px;
transition: all .3s ease;
}
input:checked + &::after {
background-color: #29ce9a;
transform: translateX(40px);
animation-name: pulseout;
animation-duration: .3s;
}
input:checked + &::before {
background-color: #29ce9a;
}
input:disabled + &::after,
input:disabled + &::before {
background-color: #e5e5e5;
}
}
@keyframes pulsein {
0%, 100% {
top: 0px;
height: 40px;
width: 40px;
}
50% {
top: 6px;
height: 28px;
width: 52px;
}
}
@keyframes pulseout {
0%, 100% {
top: 0px;
height: 40px;
width: 40px;
}
50% {
top: 6px;
height: 28px;
width: 52px;
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.