Create slider like Check Box - HTML CSS CSS Form

HTML CSS examples for CSS Form:input checkbox

Description

Create slider like Check Box

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">

hr {<!--  www  .ja  v a 2 s  . c om-->
   background-color: #ccc;
   border: 0;
   height: 1px;
   margin: 8px;
}
input[type="checkbox"]:focus{
   outline:0;
}
input[type="checkbox"] {
   appearance: none;
   background-color: #fafafa;
   border: 1px solid #d3d3d3;
   border-radius: 26px;
   cursor: pointer;
   height: 28px;
   position: relative;
   transition: border .25s .15s, box-shadow .25s .3s, padding .25s;
   width: 44px;
   vertical-align: top;
   -webkit-appearance: none;
}
input[type="checkbox"]:after {
   background-color: white;
   border: 1px solid #d3d3d3;
   border-radius: 24px;
   box-shadow: inset 0 -3px 3px rgba(0, 0, 0, 0.025), 0 1px 4px rgba(0, 0, 0, 0.15), 0 4px 4px rgba(0, 0, 0, 0.1);
   content:'';
   display: block;
   height: 24px;
   left: 0;
   position: absolute;
   right: 16px;
   top: 0;
   transition: border .25s .15s, left .25s .1s, right .15s .175s;
}
input[type="checkbox"]:checked {
   border-color: #53d76a;
   box-shadow: inset 0 0 0 13px #53d76a;
   padding-left: 18px;
   transition: border .25s, box-shadow .25s, padding .25s .15s;
}
input[type="checkbox"]:checked:after {
   border-color: #53d76a;
   left: 16px;
   right: 0;
   transition: border .25s, left .15s .25s, right .25s .175s;
}


      </style> 
 </head> 
 <body> 
  <form> 
   <input id="ckbx" type="checkbox" value="map_one"> 
  </form>  
 </body>
</html>

Related Tutorials