iOS Style Toggle Buttons
- Check-boxes - Radio boxes
by Amit Kumar
HTML
<h1>Checkbox :</h1>
<input id="checkbox1" type="checkbox" checked />
<label for="checkbox1"></label>
<input id="checkbox2" type="checkbox" />
<label for="checkbox2"></label>
<h1>Radio :</h1>
<input type="radio" name="group" id="radio1" />
<label for="radio1"></label>
<input type="radio" name="group" id="radio2" checked />
<label for="radio2"></label>
<input type="radio" name="group" id="radio3"/>
<label for="radio3"></label>
CSS
/*---=== Custom iOS Checkboxes/Radio Buttons ===---*/
body {
text-align: center;
padding: 60px auto 0;
}
input[type=checkbox],input[type=radio] {
display: none;
}
/* --- Custom iOS checkboxes & radio buttons --- */
input[type=checkbox]+label,input[type=radio]+label {
display: inline-block;
width: 60px;
height: 30px;
position: relative;
cursor: pointer;
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
box-shadow: inset 0px 5px 30px -13px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: inset 0px 5px 30px -13px rgba(0, 0, 0, 0.5);
-moz-box-shadow: inset 0px 5px 30px -13px rgba(0, 0, 0, 0.5);
-o-box-shadow: inset 0px 5px 30px -13px rgba(0, 0, 0, 0.5);
border-radius: 15px;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
-o-border-radius: 15px;
background-color: #fff;
padding: 1px;
margin: 0px;
transition: all 0.5s ease-out;
-webkit-transition: all 0.5s ease-out;
-moz-transition: all 0.5s ease-out;
-o-transition: all 0.5s ease-out;
transform: scale(1);
-webkit-transform: scale(1); /*Adjust size here*/
-moz-transform: scale(1);
-o-transform: scale(1);
}
input[type=checkbox]:checked+label,input[type=radio]:checked+label {
box-shadow: inset 0px 0px 0px 20px #53d76a;
-webkit-box-shadow: inset 0px 0px 0px 20px #53d76a;
-moz-box-shadow: inset 0px 0px 0px 20px #53d76a;
-o-box-shadow: inset 0px 0px 0px 20px #53d76a;
}
input[type=checkbox]+label:after,input[type=radio]+label:after {
left: 0;
content: " ";
position: absolute;
width: 28px;
height: 28px;
cursor: pointer;
border-radius: 50%;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
-o-border-radius: 50%;
box-shadow: 0px 2px 2px 1px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0px 2px 2px 1px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0px 2px 2px 1px rgba(0, 0, 0, 0.2);
-o-box-shadow: 0px 2px 2px 1px rgba(0, 0, 0, 0.2);
background-color:...