mirror of
https://github.com/uiverse-io/galaxy.git
synced 2025-11-28 05:00:22 +08:00
121 lines
1.9 KiB
HTML
121 lines
1.9 KiB
HTML
<label class="toggle-button-cover">
|
|
<div id="button-2" class="button r">
|
|
<input class="checkbox" type="checkbox">
|
|
<div class="knobs"></div>
|
|
<div class="layer"></div>
|
|
</div>
|
|
</label>
|
|
<style>
|
|
/* From Uiverse.io by SouravBandyopadhyay - Tags: simple, 3d, action, red, button, switch, input, toggle switch */
|
|
.toggle-button-cover {
|
|
display: inline-block;
|
|
position: relative;
|
|
width: 200px;
|
|
height: 140px;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.button-cover:before {
|
|
counter-increment: button-counter;
|
|
content: counter(button-counter);
|
|
position: absolute;
|
|
right: 0;
|
|
bottom: 0;
|
|
color: #d7e3e3;
|
|
font-size: 12px;
|
|
line-height: 1;
|
|
padding: 5px;
|
|
}
|
|
|
|
.button-cover,
|
|
.knobs,
|
|
.layer {
|
|
position: absolute;
|
|
top: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
left: 0;
|
|
}
|
|
|
|
.button {
|
|
position: relative;
|
|
top: 50%;
|
|
width: 74px;
|
|
height: 36px;
|
|
margin: -20px auto 0 auto;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.button.r,
|
|
.button.r .layer {
|
|
border-radius: 100px;
|
|
}
|
|
|
|
.checkbox {
|
|
position: relative;
|
|
width: 100%;
|
|
height: 100%;
|
|
padding: 0;
|
|
margin: 0;
|
|
opacity: 0;
|
|
cursor: pointer;
|
|
z-index: 3;
|
|
}
|
|
|
|
.knobs {
|
|
z-index: 2;
|
|
}
|
|
|
|
.layer {
|
|
width: 100%;
|
|
background-color: #ebf7fc;
|
|
transition: 0.3s ease all;
|
|
z-index: 1;
|
|
}
|
|
|
|
#button-2 .knobs:before,
|
|
#button-2 .knobs:after {
|
|
content: 'YES';
|
|
position: absolute;
|
|
top: 4px;
|
|
left: 4px;
|
|
width: 20px;
|
|
height: 10px;
|
|
color: #fff;
|
|
font-size: 10px;
|
|
font-weight: bold;
|
|
text-align: center;
|
|
line-height: 1;
|
|
padding: 9px 4px;
|
|
background-color: #03f480;
|
|
border-radius: 50%;
|
|
transition: 0.3s ease all;
|
|
}
|
|
|
|
#button-2 .knobs:before {
|
|
content: 'YES';
|
|
}
|
|
|
|
#button-2 .knobs:after {
|
|
content: 'NO';
|
|
}
|
|
|
|
#button-2 .knobs:after {
|
|
right: -28px;
|
|
left: auto;
|
|
background-color: #f44336;
|
|
}
|
|
|
|
#button-2 .checkbox:checked + .knobs:before {
|
|
left: -28px;
|
|
}
|
|
|
|
#button-2 .checkbox:checked + .knobs:after {
|
|
right: 4px;
|
|
}
|
|
|
|
#button-2 .checkbox:checked ~ .layer {
|
|
background-color: #fcebeb;
|
|
}
|
|
|
|
</style>
|