<div class="grid">
<label class="checkbox path">
<input type="checkbox">
<svg viewBox="0 0 21 21">
<path d="M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"></path>
</svg>
</label>
<label class="checkbox path">
<input type="checkbox" checked>
<svg viewBox="0 0 21 21">
<path d="M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"></path>
</svg>
</label>
<label class="checkbox bounce">
<input type="checkbox">
<svg viewBox="0 0 21 21">
<polyline points="5 10.75 8.5 14.25 16 6"></polyline>
</svg>
</label>
<label class="checkbox bounce">
<input type="checkbox" checked>
<svg viewBox="0 0 21 21">
<polyline points="5 10.75 8.5 14.25 16 6"></polyline>
</svg>
</label>
</div>
<!-- dribbble - twitter -->
<a class="dribbble" href="https://dribbble.com/shots/8947291-Checkbox" target="_blank"><img src="https://cdn.dribbble.com/assets/dribbble-ball-mark-2bd45f09c2fb58dbbfb44766d5d1d07c5a12972d602ef8b32204d28fa3dda554.svg" alt=""></a>
<a class="twitter" target="_blank" href="https://twitter.com/aaroniker_me"><svg xmlns="http://www.w3.org/2000/svg" width="72" height="72" viewBox="0 0 72 72"><path d="M67.812 16.141a26.246 26.246 0 0 1-7.519 2.06 13.134 13.134 0 0 0 5.756-7.244 26.127 26.127 0 0 1-8.313 3.176A13.075 13.075 0 0 0 48.182 10c-7.229 0-13.092 5.861-13.092 13.093 0 1.026.118 2.021.338 2.981-10.885-.548-20.528-5.757-26.987-13.679a13.048 13.048 0 0 0-1.771 6.581c0 4.542 2.312 8.551 5.824 10.898a13.048 13.048 0 0 1-5.93-1.638c-.002.055-.002.11-.002.162 0 6.345 4.513 11.638 10.504 12.84a13.177 13.177 0 0 1-3.449.457c-.846 0-1.667-.078-2.465-.231 1.667 5.2 6.499 8.986 12.23 9.09a26.276 26.276 0 0 1-16.26 5.606A26.21 26.21 0 0 1 4 55.976a37.036 37.036 0 0 0 20.067 5.882c24.083 0 37.251-19.949 37.251-37.249 0-.566-.014-1.134-.039-1.694a26.597 26.597 0 0 0 6.533-6.774z"></path></svg></a>
.checkbox {
--background: #fff;
--border: #D1D6EE;
--border-hover: #BBC1E1;
--border-active: #1E2235;
--tick: #fff;
position: relative;
input,
svg {
width: 21px;
height: 21px;
display: block;
}
input {
-webkit-appearance: none;
-moz-appearance: none;
position: relative;
outline: none;
background: var(--background);
border: none;
margin: 0;
padding: 0;
cursor: pointer;
border-radius: 4px;
transition: box-shadow .3s;
box-shadow: inset 0 0 0 var(--s, 1px) var(--b, var(--border));
&:hover {
--s: 2px;
--b: var(--border-hover);
}
&:checked {
--b: var(--border-active);
}
}
svg {
pointer-events: none;
fill: none;
stroke-width: 2px;
stroke-linecap: round;
stroke-linejoin: round;
stroke: var(--stroke, var(--border-active));
position: absolute;
top: 0;
left: 0;
width: 21px;
height: 21px;
transform: scale(var(--scale, 1)) translateZ(0);
}
&.path {
input {
&:checked {
--s: 2px;
transition-delay: .4s;
& + svg {
--a: 16.1 86.12;
--o: 102.22;
}
}
}
svg {
stroke-dasharray: var(--a, 86.12);
stroke-dashoffset: var(--o, 86.12);
transition: stroke-dasharray .6s, stroke-dashoffset .6s;
}
}
&.bounce {
--stroke: var(--tick);
input {
&:checked {
--s: 11px;
& + svg {
animation: bounce .4s linear forwards .2s;
}
}
}
svg {
--scale: 0;
}
}
}
@keyframes bounce {
50% {
transform: scale(1.2);
}
75% {
transform: scale(.9);
}
100% {
transform: scale(1);
}
}
html {
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
}
* {
box-sizing: inherit;
&:before,
&:after {
box-sizing: inherit;
}
}
// Center & dribbble
body {
min-height: 100vh;
display: flex;
font-family: 'Roboto', Arial;
justify-content: center;
align-items: center;
flex-direction: column;
background: #F6F8FF;
.grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
grid-gap: 24px;
}
.dribbble {
position: fixed;
display: block;
right: 20px;
bottom: 20px;
img {
display: block;
height: 28px;
}
}
.twitter {
position: fixed;
display: block;
right: 64px;
bottom: 14px;
svg {
width: 32px;
height: 32px;
fill: #1da1f2;
}
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.