27.2.13

Radio and Checkbox use CSS3

Radio Button

Checkbox

label {
 display: inline-block;
 cursor: pointer;
 position: relative;
 padding-left: 20px;
 font-size: 13px;
}
input[type=radio],
input[type=checkbox] {
 display: none;
}
label:before {
 content: "";
 display: inline-block;
 width: 16px;
 height: 16px;
 margin-right: 10px;
 position: absolute;
 left: 0;
 bottom: 1px;
 background-color: #EEE;
 box-shadow: inset 0px 2px 3px 0px rgba(0, 0, 0, .3), 0px 1px 0px 0px rgba(255, 255, 255, .8);
}
.radio label:before {
 border-radius: 8px;
}
.checkbox label {
 margin-bottom: 10px;
}
.checkbox label:before {
    border-radius: 3px;
}
input[type=radio]:checked + label:before {
    content: "\2022";
    color: #0C0;
    font-size: 30px;
    text-align: center;
    line-height: 18px;
}
input[type=checkbox]:checked + label:before {
 content: "\2713";
 text-shadow: 1px 1px 1px rgba(0, 0, 0, .2);
 font-size: 13px;
 color: #0C0;
 text-align: center;
    line-height: 15px;
}
<div class="radio">
<input id="male" type="radio" name="gender" value="male">
<label for="male">Male</label>
<input id="female" type="radio" name="gender" value="female">
<label for="female">Female</label>
</div>


<div class="checkbox">
<input id="check1" type="checkbox" name="check" value="check1">
<label for="check1">Checkbox 1</label>
<input id="check2" type="checkbox" name="check" value="check2">
<label for="check2">Checkbox 2</label>
</div>

Loading...
Loading...