mirror of
https://github.com/uiverse-io/galaxy.git
synced 2025-11-28 05:00:22 +08:00
51 lines
1.5 KiB
HTML
51 lines
1.5 KiB
HTML
<input type="checkbox" class="theme-checkbox">
|
|
<style>
|
|
/* From Uiverse.io by cuzpq - Tags: switch, theme, light&dark */
|
|
.theme-checkbox {
|
|
--toggle-size: 16px;
|
|
-webkit-appearance: none;
|
|
-moz-appearance: none;
|
|
appearance: none;
|
|
width: 6.25em;
|
|
height: 3.125em;
|
|
background: -webkit-gradient(linear, left top, right top, color-stop(50%, #efefef), color-stop(50%, #2a2a2a)) no-repeat;
|
|
background: -o-linear-gradient(left, #efefef 50%, #2a2a2a 50%) no-repeat;
|
|
background: linear-gradient(to right, #efefef 50%, #2a2a2a 50%) no-repeat;
|
|
background-size: 205%;
|
|
background-position: 0;
|
|
-webkit-transition: 0.4s;
|
|
-o-transition: 0.4s;
|
|
transition: 0.4s;
|
|
border-radius: 99em;
|
|
position: relative;
|
|
cursor: pointer;
|
|
font-size: var(--toggle-size);
|
|
}
|
|
|
|
.theme-checkbox::before {
|
|
content: "";
|
|
width: 2.25em;
|
|
height: 2.25em;
|
|
position: absolute;
|
|
top: 0.438em;
|
|
left: 0.438em;
|
|
background: -webkit-gradient(linear, left top, right top, color-stop(50%, #efefef), color-stop(50%, #2a2a2a)) no-repeat;
|
|
background: -o-linear-gradient(left, #efefef 50%, #2a2a2a 50%) no-repeat;
|
|
background: linear-gradient(to right, #efefef 50%, #2a2a2a 50%) no-repeat;
|
|
background-size: 205%;
|
|
background-position: 100%;
|
|
border-radius: 50%;
|
|
-webkit-transition: 0.4s;
|
|
-o-transition: 0.4s;
|
|
transition: 0.4s;
|
|
}
|
|
|
|
.theme-checkbox:checked::before {
|
|
left: calc(100% - 2.25em - 0.438em);
|
|
background-position: 0;
|
|
}
|
|
|
|
.theme-checkbox:checked {
|
|
background-position: 100%;
|
|
}
|
|
</style>
|