mirror of
https://github.com/uiverse-io/galaxy.git
synced 2025-11-28 05:00:22 +08:00
79 lines
1.5 KiB
HTML
79 lines
1.5 KiB
HTML
<label class="container">
|
|
<input checked="checked" type="checkbox">
|
|
<div class="checkmark"></div>
|
|
</label>
|
|
<style>
|
|
/* From Uiverse.io by ercnersoy - 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: 20px;
|
|
user-select: none;
|
|
}
|
|
|
|
/* Create a custom checkbox */
|
|
.checkmark {
|
|
position: relative;
|
|
top: 0;
|
|
left: 0;
|
|
height: 1.4em;
|
|
width: 1.4em;
|
|
border: 2px solid #2196F3;
|
|
border-radius: 1rem 0rem 1rem;
|
|
transform: rotate(45deg);
|
|
transition: all .5s ease-in-out;
|
|
}
|
|
|
|
/* When the checkbox is checked, add a blue background */
|
|
.container input:checked ~ .checkmark {
|
|
box-shadow: 0px 0px 40px 5px #2196F3;
|
|
border-radius: 1rem 0rem 1rem;
|
|
background-color: #2195f31f;
|
|
}
|
|
|
|
/* 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;
|
|
}
|
|
|
|
/* Style the checkmark/indicator */
|
|
.container .checkmark:after {
|
|
left: 0.35em;
|
|
top: 0.20em;
|
|
width: 0.25em;
|
|
height: 0.5em;
|
|
border: solid #2196F3;
|
|
border-width: 0 0.15em 0.15em 0;
|
|
transform: rotate(-5deg);
|
|
animation: upAnimate 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
|
|
}
|
|
|
|
@keyframes upAnimate {
|
|
from {
|
|
transform: translate(-20px, -20px) rotate(-5deg);
|
|
opacity: 0;
|
|
}
|
|
|
|
to {
|
|
transform: translate(0, 0) rotate(-5deg);
|
|
opacity: 1;
|
|
}
|
|
}
|
|
</style>
|