mirror of
https://github.com/uiverse-io/galaxy.git
synced 2025-11-28 05:00:22 +08:00
71 lines
1.4 KiB
HTML
71 lines
1.4 KiB
HTML
<div class="toggle-switch">
|
|
<label class="switch-label">
|
|
<input type="checkbox" class="checkbox">
|
|
<span class="slider"></span>
|
|
</label>
|
|
</div>
|
|
<style>
|
|
/* From Uiverse.io by Madflows - Tags: switch */
|
|
.toggle-switch {
|
|
position: relative;
|
|
width: 100px;
|
|
height: 50px;
|
|
--light: #d8dbe0;
|
|
--dark: #28292c;
|
|
--link: rgb(27, 129, 112);
|
|
--link-hover: rgb(24, 94, 82);
|
|
}
|
|
|
|
.switch-label {
|
|
position: absolute;
|
|
width: 100%;
|
|
height: 50px;
|
|
background-color: var(--dark);
|
|
border-radius: 25px;
|
|
cursor: pointer;
|
|
border: 3px solid var(--dark);
|
|
}
|
|
|
|
.checkbox {
|
|
position: absolute;
|
|
display: none;
|
|
}
|
|
|
|
.slider {
|
|
position: absolute;
|
|
width: 100%;
|
|
height: 100%;
|
|
border-radius: 25px;
|
|
-webkit-transition: 0.3s;
|
|
transition: 0.3s;
|
|
}
|
|
|
|
.checkbox:checked ~ .slider {
|
|
background-color: var(--light);
|
|
}
|
|
|
|
.slider::before {
|
|
content: "";
|
|
position: absolute;
|
|
top: 10px;
|
|
left: 10px;
|
|
width: 25px;
|
|
height: 25px;
|
|
border-radius: 50%;
|
|
-webkit-box-shadow: inset 12px -4px 0px 0px var(--light);
|
|
box-shadow: inset 12px -4px 0px 0px var(--light);
|
|
background-color: var(--dark);
|
|
-webkit-transition: 0.3s;
|
|
transition: 0.3s;
|
|
}
|
|
|
|
.checkbox:checked ~ .slider::before {
|
|
-webkit-transform: translateX(50px);
|
|
-ms-transform: translateX(50px);
|
|
transform: translateX(50px);
|
|
background-color: var(--dark);
|
|
-webkit-box-shadow: none;
|
|
box-shadow: none;
|
|
}
|
|
|
|
</style>
|