"Toggle Switch On Off"
Bootstrap 4.1.1 Snippet by anmolv886

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <span class="toggle-switch"> <input type="checkbox" value="" /> <span class="circle"></span> </span> </div> </div>
.toggle-switch { position: relative; background: #fff; width: 65px; height: 30px; line-height: 30px; border-radius: 40px; border: 1px solid #767272; display: inline-block; cursor: pointer; overflow: hidden; } .toggle-switch input[type="checkbox"] { position: absolute; width: 100%; height: 100%; left: 0; top: 0; opacity: 0; z-index: 1; cursor: pointer; } .toggle-switch span.circle { display: inline-block; margin: 0 !important; width: 22px; height: 22px; background: #ddd; border: 1px solid #ddd; border-radius: 40px; transition: 0.1s linear; position: absolute; top: 50%; left: 3px; transform: translateY(-50%); } .toggle-switch span.circle::after { content: "OFF"; position: absolute; left: 27px; top: -4px; font-weight: 500; font-size: 12px; color: #ddd; } .toggle-switch input[type="checkbox"]:checked + span.circle { transform: translate(34px, -50%); background: #333; border: 1px solid #333; } .toggle-switch input[type="checkbox"]:checked + span.circle::before { content: "ON"; position: absolute; right: 30px; top: -4px; font-weight: 500; font-size: 12px; color: #333; }

Related: See More


Questions / Comments: