mirror of
https://github.com/uiverse-io/galaxy.git
synced 2025-11-28 13:10:21 +08:00
60 lines
1 KiB
HTML
60 lines
1 KiB
HTML
<label class="switch">
|
|
<input type="checkbox">
|
|
<span class="slider"></span>
|
|
</label>
|
|
<style>
|
|
/* From Uiverse.io by zebra76966 - Tags: switch, moon, sun, toggle, light&dark, emoji */
|
|
.switch {
|
|
position: absolute;
|
|
top: 50%;
|
|
width: 30px;
|
|
height: 60px;
|
|
padding: 2px;
|
|
left: 50%;
|
|
transform: translate(-50%,-50%);
|
|
}
|
|
|
|
.switch input {
|
|
opacity: 0;
|
|
height: 0;
|
|
width: 0;
|
|
}
|
|
|
|
.slider {
|
|
position: absolute;
|
|
cursor: pointer;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
border-radius: 20px;
|
|
border: 1px solid rgba(0,0,0,0.2);
|
|
border-style: outset;
|
|
background-color: white;
|
|
transition: 0.4s;
|
|
}
|
|
|
|
.slider::before {
|
|
content: "🌞";
|
|
font-size: 22px;
|
|
line-height: 15px;
|
|
border-radius: 100%;
|
|
position: absolute;
|
|
left: -0.8px;
|
|
top: 8px;
|
|
background-color: transparent;
|
|
transition: 0.4s;
|
|
}
|
|
|
|
.switch > input:checked + .slider {
|
|
background-color: #000429;
|
|
}
|
|
|
|
.switch > input:checked + .slider:before {
|
|
content: "🌑";
|
|
font-size: 22px;
|
|
line-height: 25px;
|
|
background-color: transparent;
|
|
transform: translateY(24px);
|
|
}
|
|
</style>
|