JSFiddle - React, Tailwind, and code Playground
by Ариан Шапиро
HTML
<div class="switch">
<input type="checkbox" id="switch" class="switch-check" >
<label for="switch" class="switch-label">Check <span></span>
</label>
CSS
.switch-label:checked div {
background: red;
}
body {
background: #222222;
}
.switch {
background-color: rgba(0, 0, 0, 0.2);
border-radius: 30px;
border: 4px solid rgba(58, 58, 58, 0.1);
box-shadow: 0 0 6px rgba(0, 0, 0, 0.5) inset;
height: 42px;
margin: 40px;
position: relative;
width: 115px;
}
.switch-check {
position: absolute;
visibility: hidden;
}
.switch-label {
cursor: pointer;
display: block;
height: 42px;
text-indent: -9999px;
width: 115px;
}
.switch-label:before {
background: #fff;
background: -moz-radial-gradient(45%, circle, rgb(255, 58, 58) 0%, rgb(255, 113, 113) 100%);
background: -webkit-radial-gradient(45%, circle, rgb(255, 58, 58) 0%, rgb(255, 113, 113) 100%);
background: -o-radial-gradient(45%, circle, rgb(255, 58, 58) 0%, rgb(255, 113, 113) 100%);
border-radius: 10px;
border: 1px solid #742323;
box-shadow: 0 2px 5px rgba(255, 67, 48, 0.6), 0 0 5px rgba(255, 159, 109, 0.5) inset;
content:"";
display: block;
height: 10px;
left: -20%;
position: absolute;
top: 16px;
-webkit-transition:all 0.2s;
-moz-transition:all 0.2s;
-o-transition:all 0.2s;
transition:all 0.2s;
width: 10px;
z-index: 12;
}
.switch-label:after {
background: #fff;
background: -moz-radial-gradient(45%, circle, rgba(60, 60, 60, 0.6) 0%, rgba(151, 151, 151, 0.6) 100%);
background: -webkit-radial-gradient(45%, circle, rgba(60, 60, 60, 0.6) 0%, rgba(151, 151, 151, 0.6) 100%);
background: -o-radial-gradient(45%, circle, rgba(60, 60, 60, 0.6) 0%, rgba(151, 151, 151, 0.6) 100%);
border-radius: 10px;
border: 1px solid #111;
box-shadow: 0 2px 5px rgba(20, 20, 20, 0.5);
content:"";
display: block;
height: 10px;
right: -20%;
position: absolute;
top: 16px;
-webkit-transition:all 0.2s;
-moz-transition:all 0.2s;
-o-transition:all 0.2s;
transition:all 0.2s;
width: 10px;
z-index:...