Trang chá»§
Checkbox v3
Save
Settings
Sign Up
Log In
Save
Settings
HTML
Copy
<label class="cb"> <input type="checkbox" /> <div class="ic"> <svg viewBox="0 0 16 16" height="25" width="25" xmlns="http://www.w3.org/2000/svg"> <path d="M8 1.314C12.438-3.248 23.534 4.735 8 15-7.534 4.736 3.562-3.248 8 1.314" fill-rule="evenodd"></path> </svg> </div> </label>
CSS
Copy
.cb input { appearance: none; display: none; } .ic { width: 30px; fill: #777; cursor: pointer; transition: 0.2s; display: flex; justify-content: center; align-items: center; position: relative; transform-origin: top; } .ic::after { content: ""; position: absolute; width: 10px; height: 10px; border-radius: 50%; transform: scale(0); box-shadow: 0 30px 0 -4px #b10c0c, 30px 0 0 -4px #b10c0c, 0 -30px 0 -4px #b10c0c, -30px 0 0 -4px #b10c0c, -22px 22px 0 -4px #b10c0c, -22px -22px 0 -4px #b10c0c, 22px -22px 0 -4px #b10c0c, 22px 22px 0 -4px #b10c0c; } .ic::before { content: ""; position: absolute; border-radius: 50%; border: 1px solid #b10c0c; opacity: 0; } .cb:hover .ic { fill: #333; } .cb input:checked + .ic { fill: #b10c0c; animation: ck 0.3s forwards; transition-delay: 0.3s; } .cb input:checked + .ic::before { animation: circ 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; animation-delay: 0.3s; } .cb input:checked + .ic::after { animation: dots 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; animation-delay: 0.3s; } @keyframes ck { 50% { transform: scaleY(0.6); } 100% { transform: scaleY(1); } } @keyframes circ { from { width: 0; height: 0; opacity: 0; } 90% { width: 40px; height: 40px; opacity: 1; } to { opacity: 0; } } @keyframes dots { from { transform: scale(0); } 40% { opacity: 1; } to { transform: scale(0.8); opacity: 0; } }
JS
Copy