"Toggle Switch"
Bootstrap 3.2.0 Snippet by FelFly

<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <BR></BR> <div class="container"> <hr> <div class="row"> <div class="col-md-2"> <h4>Android</h4> <div class="onoffswitch3"> <input type="checkbox" name="onoffswitch3" class="onoffswitch3-checkbox" id="myonoffswitch3" checked> <label class="onoffswitch3-label" for="myonoffswitch3"> <span class="onoffswitch3-inner"> <span class="onoffswitch3-active"><span class="onoffswitch3-switch">Y</span></span> <span class="onoffswitch3-inactive"><span class="onoffswitch3-switch">N</span></span> </span> </label> </div> </div> <div class="col-md-2"> <h4>Windows</h4> <div class="onoffswitch4"> <input type="checkbox" name="onoffswitch4" class="onoffswitch4-checkbox" id="myonoffswitch4" checked> <label class="onoffswitch4-label" for="myonoffswitch4"> <span class="onoffswitch4-inner"></span> <span class="onoffswitch4-switch"></span> </label> </div> </div> <div class="col-md-2"> <h4>iOS7 Style</h4> <div class="switch"> <input id="cmn-toggle-4" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"> <label for="cmn-toggle-4"></label> </div> </div> </div> </div>
.onoffswitch3 { position: relative; width: 90px; -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none; } .onoffswitch3-checkbox { display: none; } .onoffswitch3-label { display: block; overflow: hidden; cursor: pointer; border: 0px solid #999999; border-radius: 0px; } .onoffswitch3-inner { display: block; width: 200%; margin-left: -100%; -moz-transition: margin 0.3s ease-in 0s; -webkit-transition: margin 0.3s ease-in 0s; -o-transition: margin 0.3s ease-in 0s; transition: margin 0.3s ease-in 0s; } .onoffswitch3-inner > span { display: block; float: left; position: relative; width: 50%; height: 30px; padding: 0; line-height: 30px; font-size: 14px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .onoffswitch3-inner .onoffswitch3-active { padding-left: 10px; background-color: #EEEEEE; color: #FFFFFF; } .onoffswitch3-inner .onoffswitch3-inactive { padding-right: 10px; background-color: #EEEEEE; color: #FFFFFF; text-align: right; } .onoffswitch3-switch { display: block; width: 18px; margin: 0px; text-align: center; border: 0px solid #999999;border-radius: 0px; position: absolute; top: 0; bottom: 0; } .onoffswitch3-active .onoffswitch3-switch { background: #27A1CA; left: 0; } .onoffswitch3-inactive .onoffswitch3-switch { background: #A1A1A1; right: 0; } .onoffswitch3-active .onoffswitch3-switch:before { content: " "; position: absolute; top: 0; left: 18px; border-style: solid; border-color: #27A1CA transparent transparent #27A1CA; border-width: 15px 9px; } .onoffswitch3-inactive .onoffswitch3-switch:before { content: " "; position: absolute; top: 0; right: 18px; border-style: solid; border-color: transparent #A1A1A1 #A1A1A1 transparent; border-width: 15px 9px; } .onoffswitch3-checkbox:checked + .onoffswitch3-label .onoffswitch3-inner { margin-left: 0; } .onoffswitch4 { position: relative; width: 90px; -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none; } .onoffswitch4-checkbox { display: none; } .onoffswitch4-label { display: block; overflow: hidden; cursor: pointer; border: 2px solid #27A1CA; border-radius: 0px; } .onoffswitch4-inner { display: block; width: 200%; margin-left: -100%; -moz-transition: margin 0.3s ease-in 0s; -webkit-transition: margin 0.3s ease-in 0s; -o-transition: margin 0.3s ease-in 0s; transition: margin 0.3s ease-in 0s; } .onoffswitch4-inner:before, .onoffswitch4-inner:after { display: block; float: left; width: 50%; height: 30px; padding: 0; line-height: 26px; font-size: 14px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; border: 2px solid transparent; background-clip: padding-box; } .onoffswitch4-inner:before { content: "Yes"; padding-left: 10px; background-color: #FFFFFF; color: #27A1CA; } .onoffswitch4-inner:after { content: "No"; padding-right: 10px; background-color: #FFFFFF; color: #666666; text-align: right; } .onoffswitch4-switch { display: block; width: 25px; margin: 0px; background: #27A1CA; position: absolute; top: 0; bottom: 0; right: 65px; -moz-transition: all 0.3s ease-in 0s; -webkit-transition: all 0.3s ease-in 0s; -o-transition: all 0.3s ease-in 0s; transition: all 0.3s ease-in 0s; } .onoffswitch4-checkbox:checked + .onoffswitch4-label .onoffswitch4-inner { margin-left: 0; } .onoffswitch4-checkbox:checked + .onoffswitch4-label .onoffswitch4-switch { right: 0px; } .cmn-toggle { position: absolute; margin-left: -9999px; visibility: hidden; } .cmn-toggle + label { display: block; position: relative; cursor: pointer; outline: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } input.cmn-toggle-round-flat + label { padding: 2px; width: 75px; height: 30px; background-color: #dddddd; -webkit-border-radius: 60px; -moz-border-radius: 60px; -ms-border-radius: 60px; -o-border-radius: 60px; border-radius: 60px; -webkit-transition: background 0.4s; -moz-transition: background 0.4s; -o-transition: background 0.4s; transition: background 0.4s; } input.cmn-toggle-round-flat + label:before, input.cmn-toggle-round-flat + label:after { display: block; position: absolute; content: ""; } input.cmn-toggle-round-flat + label:before { top: 2px; left: 2px; bottom: 2px; right: 2px; background-color: #fff; -webkit-border-radius: 60px; -moz-border-radius: 60px; -ms-border-radius: 60px; -o-border-radius: 60px; border-radius: 60px; -webkit-transition: background 0.4s; -moz-transition: background 0.4s; -o-transition: background 0.4s; transition: background 0.4s; } input.cmn-toggle-round-flat + label:after { top: 4px; left: 4px; bottom: 4px; width: 22px; background-color: #dddddd; -webkit-border-radius: 52px; -moz-border-radius: 52px; -ms-border-radius: 52px; -o-border-radius: 52px; border-radius: 52px; -webkit-transition: margin 0.4s, background 0.4s; -moz-transition: margin 0.4s, background 0.4s; -o-transition: margin 0.4s, background 0.4s; transition: margin 0.4s, background 0.4s; } input.cmn-toggle-round-flat:checked + label { background-color: #27A1CA; } input.cmn-toggle-round-flat:checked + label:after { margin-left: 45px; background-color: #27A1CA; }

Related: See More


Questions / Comments: