galaxy/Toggle-switches/alexruix_lazy-dragon-53.html

61 lines
1.1 KiB
HTML

<label class="switch">
<input type="checkbox">
<span class="slider"></span>
</label>
<style>
/* From Uiverse.io by alexruix - Tags: red, 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;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-radius: 30px;
box-shadow: 0 0 0 2px #f32f2150;
border: 4px solid transparent;
overflow: hidden;
transition: .4s;
background: transparent;
}
.slider:before {
position: absolute;
content: "";
width: 100%;
height: 100%;
border-radius: 30px;
background-color: #f32f21;
transform: translateX(-50%);
transition: .4s;
}
input:checked + .slider {
background-color: #f7b48e;
}
input:focus:checked + .slider {
box-shadow: 0 0 0 2px #f32f21, 0 0 4px #777;
}
input:checked + .slider:before {
transform: translateX(1.5em);
}
</style>