.switch { position: relative; display: inline-block; width: 30px; height: 20px; } .switch input { display: none; } .slider.round { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; -webkit-transition: .4s; transition: .4s; } .slider.round:before { position: absolute; content: ""; height: 13px; width: 13px; left: 4px; bottom: 4px; background-color: white; -webkit-transition: .4s; transition: .4s; } .switch span { display: inline-block; position: relative; width: 50px; margin-left: 35px; } input:checked + .slider.round { background-color: #ff9e51; } input:focus + .slider.round { box-shadow: 0 0 1px #ff9e51; } input:checked + .slider.round:before { -webkit-transform: translateX(9px); -ms-transform: translateX(9px); transform: translateX(9px); } /* Rounded sliders */ .slider.round { border-radius: 34px; } .slider.round:before { border-radius: 50%; } /* yet another switch*/ .switchNew { position: relative; display: inline-block; width: 30px; height: 20px; } .switchNew input { display: none; } .slider.new { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; -webkit-transition: .4s; transition: .4s; } .slider.new:before { position: absolute; content: ""; height: 13px; width: 13px; left: 4px; bottom: 4px; background-color: white; -webkit-transition: .4s; transition: .4s; } input:checked + .slider.new { background-color: #ccc; } input:checked + .slider.new:before { -webkit-transform: translateX(9px); } .slider.new { border-radius: 34px; } .slider.new:before { border-radius: 50%; }