"Checkbox Styles"
Bootstrap 4.1.1 Snippet by trinhquan

<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"> <h2 style="margin: auto; color:red; font-weight: bold; font-size:56px; margin-top:50px;">Checkbox Styles</h2> </div> <section title=".slideOne"> <div class="slideOne"> <input type="checkbox" value="None" id="slideOne" name="check" checked /> <label for="slideOne"></label> </div> <!-- end .slideOne --> </section> <section title=".slideTwo"> <div class="slideTwo"> <input type="checkbox" value="None" id="slideTwo" name="check" checked /> <label for="slideTwo"></label> </div> <!-- end .slideTwo --> </section> <section title=".slideThree"> <div class="slideThree"> <input type="checkbox" value="None" id="slideThree" name="check" checked /> <label for="slideThree"></label> </div> <!-- end .slideThree --> </section> <section title=".roundedOne"> <div class="roundedOne"> <input type="checkbox" value="None" id="roundedOne" name="check" checked /> <label for="roundedOne"></label> </div> <!-- end .roundedOne --> </section> <section title=".roundedTwo"> <div class="roundedTwo"> <input type="checkbox" value="None" id="roundedTwo" name="check" checked /> <label for="roundedTwo"></label> </div> <!-- end .roundedTwo --> </section> </div>
body { background: #337ab7; } /* .slideOne */ .slideOne { width: 50px; height: 10px; background: #333; margin: 20px auto; position: relative; border-radius: 50px; box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); } .slideOne label { display: block; width: 16px; height: 16px; position: absolute; top: -3px; left: -3px; cursor: pointer; background: #fcfff4; background: linear-gradient(to bottom, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); border-radius: 50px; box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.3); transition: all 0.4s ease; } .slideOne input[type=checkbox] { visibility: hidden; } .slideOne input[type=checkbox]:checked + label { left: 37px; } /* end .slideOne */ /* .slideTwo */ .slideTwo { width: 80px; height: 30px; background: #333; margin: 20px auto; position: relative; border-radius: 50px; box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); } .slideTwo :after { content: ''; position: absolute; top: 14px; left: 14px; height: 2px; width: 52px; background: #111; border-radius: 50px; box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2); } .slideTwo label { display: block; width: 22px; height: 22px; cursor: pointer; position: absolute; top: 4px; z-index: 1; left: 4px; background: #fcfff4; border-radius: 50px; transition: all 0.4s ease; box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3); background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); } .slideTwo label:after { content: ''; width: 10px; height: 10px; position: absolute; top: 6px; left: 6px; background: #333; border-radius: 50px; box-shadow: inset 0px 1px 1px rgba(0,0,0,1), 0px 1px 0px rgba(255,255,255,0.9); } .slideTwo input[type=checkbox] { visibility: hidden; } .slideTwo input[type=checkbox]:checked + label { left: 54px; } .slideTwo input[type=checkbox]:checked + label:after { background: #27ae60; } /* end .slideTwo */ /* .slideThree */ .slideThree { width: 80px; height: 26px; background: #333; margin: 20px auto; position: relative; border-radius: 50px; box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2); } .slideThree:after { content: 'OFF'; color: #000; position: absolute; right: 10px; z-index: 0; font: 12px/26px Arial, sans-serif; font-weight: bold; text-shadow: 1px 1px 0px rgba(255,255,255,.15); } .slideThree:before { content: 'ON'; color: #27ae60; position: absolute; left: 10px; z-index: 0; font: 12px/26px Arial, sans-serif; font-weight: bold; } .slideThree label { display: block; width: 34px; height: 20px; cursor: pointer; position: absolute; top: 3px; left: 3px; z-index: 1; background: #fcfff4; background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); border-radius: 50px; transition: all 0.4s ease; box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3); } .slideThree input[type=checkbox] { visibility: hidden; } .slideThree input[type=checkbox]:checked + label { left: 43px; } /* .roundedOne */ .roundedOne { width: 28px; height: 28px; position: relative; margin: 20px auto; background: #fcfff4; background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); border-radius: 50px; box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5); } .roundedOne label { width: 20px; height: 20px; cursor: pointer; position: absolute; left: 4px; top: 4px; background: linear-gradient(top, #222 0%, #45484d 100%); border-radius: 50px; box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1); } .roundedOne label:after { content: ''; width: 16px; height: 16px; position: absolute; top: 2px; left: 2px; background: #27ae60; background: linear-gradient(top, #27ae60 0%, darken(#27ae60, 20%) 100%); opacity: 0; border-radius: 50px; box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5); } .roundedOne label:hover::after { opacity: 0.3; } .roundedOne input[type=checkbox] { visibility: hidden; } .roundedOne input[type=checkbox]:checked + label:after { opacity: 1; } /* end .roundedOne */ /* .roundedTwo */ .roundedTwo { width: 28px; height: 28px; position: relative; margin: 20px auto; background: #fcfff4; background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); border-radius: 50px; box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5); } .roundedTwo label { width: 20px; height: 20px; position: absolute; top: 4px; left: 4px; cursor: pointer; background: #27ae60; border-radius: 50px; box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1); } .roundedTwo label:after { content: ''; width: 11px; height: 7px; position: absolute; top: 5px; left: 4px; border: 3px solid #fcfff4; border-top: none; border-right: none; background: transpalet; opacity: 0; transform: rotate(-45deg); } .roundedTwo label:hover::after { opacity: 0.3; } .roundedTwo input[type=checkbox] { visibility: hidden; } .roundedTwo input[type=checkbox]:checked + label:after { opacity: 1; } /* end .roundedTwo */

Related: See More


Questions / Comments: