mirror of
https://github.com/uiverse-io/galaxy.git
synced 2025-11-28 13:10:21 +08:00
89 lines
1.8 KiB
HTML
89 lines
1.8 KiB
HTML
|
|
<label class="container">
|
|
<input type="checkbox" checked="checked">
|
|
<div class="checkmark"></div>
|
|
</label>
|
|
|
|
|
|
|
|
<style>
|
|
/* From Uiverse.io by AIVIIID - Tags: checkbox */
|
|
/* Hide the default checkbox */
|
|
.container input {
|
|
position: absolute;
|
|
opacity: 0;
|
|
cursor: pointer;
|
|
height: 0;
|
|
width: 0;
|
|
}
|
|
|
|
.container {
|
|
display: block;
|
|
position: relative;
|
|
cursor: pointer;
|
|
font-size: 25px;
|
|
user-select: none;
|
|
}
|
|
|
|
/* Create a custom checkbox */
|
|
.checkmark {
|
|
position: relative;
|
|
top: 0;
|
|
left: 0;
|
|
height: 1.3em;
|
|
width: 1.3em;
|
|
background: black;
|
|
border-radius: 50px;
|
|
transition: all 0.7s;
|
|
--spread: 20px;
|
|
}
|
|
|
|
/* When the checkbox is checked, add a blue background */
|
|
.container input:checked ~ .checkmark {
|
|
background: black;
|
|
box-shadow: -10px -10px var(--spread) 0px #FFD700, 0 -10px var(--spread) 0px #FFD700, 10px -10px var(--spread) 0px #FFD700, 10px 0 var(--spread) 0px #FFD700, 10px 10px var(--spread) 0px #FFD700, 0 10px var(--spread) 0px #FFD700, -10px 10px var(--spread) 0px #FFD700;
|
|
}
|
|
|
|
/* Create the checkmark/indicator (hidden when not checked) */
|
|
.checkmark:after {
|
|
content: "";
|
|
position: absolute;
|
|
display: none;
|
|
}
|
|
|
|
/* Show the checkmark when checked */
|
|
.container input:checked ~ .checkmark:after {
|
|
display: block;
|
|
animation: checkmark 0.3s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
|
|
}
|
|
|
|
/* Style the checkmark/indicator */
|
|
.container .checkmark:after {
|
|
left: 0.45em;
|
|
top: 0.25em;
|
|
width: 0.25em;
|
|
height: 0.5em;
|
|
border: solid #FFD700;
|
|
border-width: 0 0.15em 0.15em 0;
|
|
transform: rotate(45deg);
|
|
}
|
|
|
|
/* Add animation for checkmark */
|
|
@keyframes checkmark {
|
|
from {
|
|
transform: rotate(-45deg) scale(0);
|
|
}
|
|
|
|
to {
|
|
transform: rotate(45deg) scale(1);
|
|
}
|
|
}
|
|
|
|
/* Style the label text */
|
|
.container span {
|
|
margin-left: 2em;
|
|
color: black;
|
|
font-weight: bold;
|
|
}
|
|
|
|
</style>
|