mirror of
https://github.com/uiverse-io/galaxy.git
synced 2025-11-27 20:50:21 +08:00
93 lines
2.1 KiB
HTML
93 lines
2.1 KiB
HTML
<div class="btn-container">
|
|
|
|
<label class="switch btn-color-mode-switch">
|
|
<input value="1" id="color_mode" name="color_mode" type="checkbox">
|
|
<label class="btn-color-mode-switch-inner" data-off="AM" data-on="PM" for="color_mode"></label>
|
|
</label>
|
|
|
|
</div>
|
|
<style>
|
|
/* From Uiverse.io by JaydipPrajapati1910 - Tags: switch, toggle switch, AM/PM */
|
|
.btn-container {
|
|
display: table-cell;
|
|
vertical-align: middle;
|
|
text-align: center;
|
|
}
|
|
|
|
.btn-color-mode-switch {
|
|
display: inline-block;
|
|
margin: 0px;
|
|
position: relative;
|
|
}
|
|
|
|
.btn-color-mode-switch > label.btn-color-mode-switch-inner {
|
|
margin: 0px;
|
|
width: 140px;
|
|
height: 40px;
|
|
background-color: #fcce8a;
|
|
border-radius: 26px;
|
|
overflow: hidden;
|
|
position: relative;
|
|
transition: all 0.3s ease;
|
|
/*box-shadow: 0px 0px 8px 0px rgba(17, 17, 17, 0.34) inset;*/
|
|
display: block;
|
|
}
|
|
|
|
.btn-color-mode-switch > label.btn-color-mode-switch-inner:before {
|
|
content: attr(data-on);
|
|
position: absolute;
|
|
font-size: 20px;
|
|
font-weight: 600;
|
|
top: 7px;
|
|
right: 20px;
|
|
color: #222;
|
|
}
|
|
|
|
.btn-color-mode-switch > label.btn-color-mode-switch-inner:after {
|
|
content: attr(data-off);
|
|
width: 70px;
|
|
height: 25px;
|
|
background: #fff;
|
|
border-radius: 26px;
|
|
position: absolute;
|
|
font-size: 20px;
|
|
display: flex;
|
|
justify-content: center;
|
|
left: 2px;
|
|
top: 2px;
|
|
text-align: center;
|
|
transition: all 0.3s ease;
|
|
box-shadow: 0px 0px 6px -2px #111;
|
|
padding: 5px 0px;
|
|
color: #222;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.btn-color-mode-switch input[type="checkbox"] {
|
|
cursor: pointer;
|
|
width: 50px;
|
|
height: 25px;
|
|
opacity: 0;
|
|
position: absolute;
|
|
top: 0;
|
|
z-index: 1;
|
|
margin: 0px;
|
|
}
|
|
|
|
.btn-color-mode-switch input[type="checkbox"]:checked + label.btn-color-mode-switch-inner {
|
|
background-color: #fcce8a;
|
|
}
|
|
|
|
.btn-color-mode-switch input[type="checkbox"]:checked + label.btn-color-mode-switch-inner:after {
|
|
content: attr(data-on);
|
|
left: 68px;
|
|
}
|
|
|
|
.btn-color-mode-switch input[type="checkbox"]:checked + label.btn-color-mode-switch-inner:before {
|
|
content: attr(data-off);
|
|
right: auto;
|
|
left: 20px;
|
|
}
|
|
|
|
|
|
</style>
|