mirror of
https://github.com/uiverse-io/galaxy.git
synced 2025-11-28 05:00:22 +08:00
71 lines
1.3 KiB
HTML
71 lines
1.3 KiB
HTML
<label class="switch">
|
|
<input type="checkbox">
|
|
<span class="slider"></span>
|
|
</label>
|
|
<style>
|
|
/* From Uiverse.io by gharsh11032000 - Tags: switch, checkbox, toggle, toggle switch */
|
|
/* The switch - the box around the slider */
|
|
.switch {
|
|
font-size: 17px;
|
|
position: relative;
|
|
display: inline-block;
|
|
width: 3.5em;
|
|
height: 2em;
|
|
}
|
|
|
|
/* Hide default HTML checkbox */
|
|
.switch input {
|
|
opacity: 0;
|
|
width: 0;
|
|
height: 0;
|
|
}
|
|
|
|
/* The slider */
|
|
.slider {
|
|
position: absolute;
|
|
cursor: pointer;
|
|
inset: 0;
|
|
background: white;
|
|
border-radius: 50px;
|
|
overflow: hidden;
|
|
transition: all 0.4s cubic-bezier(0.215, 0.610, 0.355, 1);
|
|
}
|
|
|
|
.slider:before {
|
|
position: absolute;
|
|
content: "";
|
|
height: 1.4em;
|
|
width: 1.4em;
|
|
right: 0.3em;
|
|
bottom: 0.3em;
|
|
transform: translateX(150%);
|
|
background-color: #59d102;
|
|
border-radius: inherit;
|
|
transition: all 0.4s cubic-bezier(0.215, 0.610, 0.355, 1);
|
|
}
|
|
|
|
.slider:after {
|
|
position: absolute;
|
|
content: "";
|
|
height: 1.4em;
|
|
width: 1.4em;
|
|
left: 0.3em;
|
|
bottom: 0.3em;
|
|
background-color: #cccccc;
|
|
border-radius: inherit;
|
|
transition: all 0.4s cubic-bezier(0.215, 0.610, 0.355, 1);
|
|
}
|
|
|
|
.switch input:focus + .slider {
|
|
box-shadow: 0 0 1px #59d102;
|
|
}
|
|
|
|
.switch input:checked + .slider:before {
|
|
transform: translateY(0);
|
|
}
|
|
|
|
.switch input:checked + .slider::after {
|
|
transform: translateX(-150%);
|
|
}
|
|
|
|
</style>
|