galaxy/Toggle-switches/The-Best-Codes_bright-rabbit-33.html

52 lines
No EOL
978 B
HTML

<div class="toggle-switch">
<input class="toggle-input" id="toggle" type="checkbox" />
<label class="toggle-label" for="toggle"></label>
</div>
<style>
/* From Uiverse.io by The-Best-Codes - Tags: material design, animation, green, switch, checkbox, modern, css, css effect */
.toggle-switch {
display: inline-block;
position: relative;
width: 60px;
height: 34px;
}
.toggle-input {
display: none;
}
.toggle-label {
position: absolute;
top: 0;
left: 0;
width: 60px;
height: 34px;
background-color: #ccc;
border-radius: 34px;
cursor: pointer;
transition: background-color 0.3s;
}
.toggle-label:before {
content: "";
position: absolute;
top: 2px;
left: 2px;
width: 30px;
height: 30px;
background-color: #fff;
border-radius: 50%;
transition: transform 0.3s;
}
.toggle-input:checked + .toggle-label {
background-color: #4fbf26;
}
.toggle-input:checked + .toggle-label:before {
transform: translateX(26px);
}
</style>