Demo
HTML for checkbox is
With Label
<div class="boxes withlabel">
<input type="checkbox" id="rj-1">
<label for="rj-1">Hello World</label>
<input type="checkbox" id="rj-2" checked>
<label for="rj-2">RJ Code for every one </label>
<input type="checkbox" id="rj-3">
<label for="rj-3">Checkbox with label</label>
</div>
With out Label
<div class="boxes without">
<input type="checkbox" id="box-1">
<input type="checkbox" id="box-2" checked>
<input type="checkbox" id="box-3">
</div>
CSS
/* With label Checkboxes styles*/
.withlabel input[type="checkbox"] { display: none; }
.withlabel input[type="checkbox"] + label {
display: block;
position: relative;
padding-left: 35px;
margin-bottom: 20px;
font: 14px/20px 'Open Sans', Arial, sans-serif;
color: #fff;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
.withlabel input[type="checkbox"] + label:last-child { margin-bottom: 0; }
.withlabel input[type="checkbox"] + label:before {
content: '';
display: block;
width: 20px;
height: 20px;
border: 2px solid #fff;
position: absolute;
left: 0;
top: 0;
opacity: .6;
-webkit-transition: all .12s, border-color .08s;
transition: all .12s, border-color .08s;
}
.withlabel input[type="checkbox"]:checked + label:before {
width: 10px;
top: -5px;
left: 5px;
border-radius: 0;
opacity: 1;
border-top-color: transparent;
border-left-color: transparent;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
/* With out Checkboxes styles*/
.without input[type="checkbox"] {
display: block;
position: relative;
margin-bottom: 20px;
width:0;
cursor: pointer;
}
.without input[type="checkbox"]:last-child { margin-bottom: 0; }
.without input[type="checkbox"]:before {
content: '';
background:#F46A4A;
display: block;
width: 20px;
height: 20px;
border: 2px solid #fff;
position: absolute;
left: 0;
top: 0;
-webkit-transition: all .12s, border-color .08s;
transition: all .12s, border-color .08s;
}
.without input[type="checkbox"]:checked:before {
width: 10px;
top: -5px;
left: 5px;
border-radius: 0;
opacity: 1;
border-top-color: transparent;
border-left-color: transparent;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
Enjoy Comments are welcome :)
No comments:
Post a Comment