JSFiddle - React, Tailwind, and code Playground
by David Sch
HTML
<input class="x_inp_check_anim" id="cbx" type="checkbox" style="display: none"/>
<label class="x_check_anim" for="cbx"><span>
<svg width="12px" height="9px" viewbox="0 0 12 9">
<polyline points="1 5 4 8 11 1"></polyline>
</svg></span><span>Reward yourself with a nap</span></label>
CSS
body {
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
font-family: "Open Sans", sans-serif;
font-size: 16px;
color: #00104B;
}
.x_check_anim {
-webkit-user-select: none;
user-select: none;
-webkit-tap-highlight-color: transparent;
cursor: pointer;
}
.x_check_anim span {
display: inline-block;
vertical-align: middle;
transform: translate3d(0, 0, 0);
}
.x_check_anim span:first-child {
position: relative;
width: 24px;
height: 24px;
border-radius: 50%;
transform: scale(1);
vertical-align: middle;
border: 1px solid #B9B8C3;
transition: all 0.2s ease;
}
.x_check_anim span:first-child svg {
position: absolute;
z-index: 1;
top: 8px;
left: 6px;
fill: none;
stroke: white;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
stroke-dasharray: 16px;
stroke-dashoffset: 16px;
transition: all 0.3s ease;
transition-delay: 0.1s;
transform: translate3d(0, 0, 0);
}
.x_check_anim span:first-child:before {
content: "";
width: 100%;
height: 100%;
background: #506EEC;
display: block;
transform: scale(0);
opacity: 1;
border-radius: 50%;
transition-delay: 0.2s;
}
.x_check_anim span:last-child {
margin-left: 8px;
}
.x_check_anim span:last-child:after {
content: "";
position: absolute;
top: 8px;
left: 0;
height: 1px;
width: 100%;
background: #B9B8C3;
transform-origin: 0 0;
transform: scaleX(0);
}
.x_check_anim:hover span:first-child {
border-color: #3c53c7;
}
.x_inp_check_anim:checked + .x_check_anim span:first-child {
border-color: #3c53c7;
background: #3c53c7;
animation: check 0.6s ease;
}
.x_inp_check_anim:checked + .x_check_anim span:first-child svg {
stroke-dashoffset: 0;
}
.x_inp_check_anim:checked + .x_check_anim span:first-child:before {
transform: scale(2.2);
opacity: 0;
transition: all 0.6s ease;
}
.x_inp_check_anim:checked + .x_check_anim span:last-child {
color: #B9B8C3;
transition: all 0.3s...