Hello Readers! In this blog we will be creating custom check boxes that can be used in forms. Here is an example of custom check boxes using pure css.
CSS Code:
/*-- custom checkbox radio --*/
.cust-checkbox {
opacity: 0;
position: absolute;
}
.cust-checkbox, .cust-checkboxLabel {
display: inline-block;
vertical-align: middle;
margin: 0px;
cursor: pointer;
font-weight: normal;
}
.cust-checkbox + .cust-checkboxLabel:before {
content: '';
background: transparent;
border: 2px solid #5E605F;
display: inline-block;
vertical-align: middle;
width: 26px;
height: 26px;
margin-right: 15px;
text-align: center;
}
.cust-checkbox:checked + .cust-checkboxLabel:before {
content: "";
font-size: 17px;
color: #fff;
line-height: 26px;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
background: #F68930;
border: 2px solid #F68930;
border-radius: 0;
}
.cust-checkbox[disabled] + .cust-checkboxLabel:before{
background: #ccc;
border-color: #aeaeae;
cursor: no-drop;
}
.cust-checkbox[disabled] + .cust-checkboxLabel{color: #aeaeae;cursor: no-drop;}
HTML Code:
<section style="text-align:center">
<form>
<h3 >Custom Checkbox button</h3>
<input id="html" class="cust-checkbox" name="HTML" type="checkbox" checked>
<label for="html" class="cust-checkboxLabel">HTML</label>
<input id="css" class="cust-checkbox" name="CSS" type="checkbox">
<label for="css" class="cust-checkboxLabel">CSS</label>
<input id="css" class="cust-checkbox" name="CSS" type="checkbox">
<label for="css" class="cust-checkboxLabel">JAVASCRIPT</label>
</form>
</section>
Output :
0 Comment(s)