#map input[type=checkbox]{ visibility: hidden; } .custom-chk{ width: 120px; height: 40px; background: #333; /*margin: 20px 60px;*/ border-radius: 50px; position: relative; display: inline-block; } .custom-chk:before{ content: 'On'; position: absolute; top: 12px; left: 13px; height: 2px; color: #26ca28; font-size: 16px; } .custom-chk:after{ content: 'Off'; position: absolute; top: 12px; left: 84px; height: 2px; color: #111; font-size: 16px; } .custom-chk label{ display: block; width: 52px; height: 22px; border-radius: 50px; transition: all .5s ease; cursor: pointer; position: absolute; top: 9px; z-index: 1; left: 12px; background: #ddd; } .custom-chk input[type=checkbox]:checked + label{ left: 60px; background: #26ca28; }