Switch Buttons CSS
by e_kurbanov
HTML
<div class="switch-button-container">
<label class="switch-btn">
<input type="radio" name="test" checked="checked">
<span class="custom-radio">ON</span>
</label>
<label class="switch-btn">
<input type="radio" name="test">
<span class="custom-radio">OFF</span>
</label>
</div>
CSS
body * {
box-sizing: border-box;
}
.switch-button-container {
position: relative;
height: 40px;
width: 150px;
overflow: hidden;
line-height: 40px;
}
.switch-btn {
position: relative;
float: left;
width: 50%;
height: 100%;
}
.switch-btn .custom-radio {
position: absolute;
top: 0;
height: 100%;
width: 100%;
display: block;
background: #407140;
text-align: center;
color: #57a95e;
}
.switch-btn input:checked+.custom-radio {
background: rgb(210, 255, 82);
color: #055f0d;
background: radial-gradient(ellipse at center, rgb(210, 255, 82) 0%, rgb(145, 232, 66) 100%);
}