mirror of
https://github.com/uiverse-io/galaxy.git
synced 2025-11-28 05:00:22 +08:00
72 lines
1.5 KiB
HTML
72 lines
1.5 KiB
HTML
<label class="switch">
|
|
<input checked="" type="checkbox" class="toggle">
|
|
<span class="slider"></span>
|
|
<span class="card-side"></span>
|
|
</label>
|
|
<style>
|
|
/* From Uiverse.io by andrew-demchenk0 - Tags: blue, switch, on, off, toggle, text animation, switcher, color, text, toggle switch */
|
|
.switch {
|
|
--input-focus: #2d8cf0;
|
|
--bg-color: #fff;
|
|
--bg-color-alt: #666;
|
|
--main-color: #323232;
|
|
--input-out-of-focus: #ccc;
|
|
position: relative;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
gap: 30px;
|
|
width: 70px;
|
|
height: 36px;
|
|
transform: translateX(calc(50% - 10px));
|
|
}
|
|
|
|
.toggle {
|
|
opacity: 0;
|
|
}
|
|
|
|
.slider {
|
|
box-sizing: border-box;
|
|
border-radius: 100px;
|
|
border: 2px solid var(--main-color);
|
|
box-shadow: 4px 4px var(--main-color);
|
|
position: absolute;
|
|
cursor: pointer;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background-color: var(--input-out-of-focus);
|
|
transition: 0.3s;
|
|
}
|
|
|
|
.slider:before {
|
|
content: "off";
|
|
box-sizing: border-box;
|
|
height: 30px;
|
|
width: 30px;
|
|
position: absolute;
|
|
left: 2px;
|
|
bottom: 1px;
|
|
border: 2px solid var(--main-color);
|
|
border-radius: 100px;
|
|
background-color: var(--bg-color);
|
|
color: var(--main-color);
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
text-align: center;
|
|
line-height: 25px;
|
|
transition: 0.3s;
|
|
}
|
|
|
|
.toggle:checked + .slider {
|
|
background-color: var(--input-focus);
|
|
transform: translateX(-32px);
|
|
}
|
|
|
|
.toggle:checked + .slider:before {
|
|
content: "on";
|
|
transform: translateX(32px);
|
|
}
|
|
</style>
|