CSS Checkbox

How to change checkbox style using CSS

by Ayyappan Sakthivadivel

HTML

<div>
    <input type="checkbox" id="checkbox1" name="checkbox[]" class="custcheck"/>
    <label for="checkbox1">Checkbox 1</label><br>
<input type="checkbox" id="checkbox1" name="checkbox[]" class="custcheck"/>
    <label for="checkbox1">Checkbox 1</label><br>    
    <input type="checkbox" id="checkbox2" name="checkbox[]"/>
    <label for="checkbox2">Checkbox 2</label>
</div>

CSS

@import url(//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css);

input[type=checkbox] + label:before {
    font-family: FontAwesome;
    display: inline-block;
    font-size: 19px;
}

input[type="checkbox"]{
    appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    border: 1px solid #c8c6c6;
    width: 15px;
    height: 15px;
    margin: 0 5px 0 0;
     border: 1px solid #f00;
}

input[type="checkbox"].custcheck:checked{
height:15px;
width:15px;
     border: 1px solid #fff;
  outline: 1px solid #f00;
  background-color: #f00;
}

input[type=checkbox]#checkbox2 {
    display: none;
}

input[type=checkbox]#checkbox2 + label:before { 
    content: "\f096"; 
    letter-spacing: 10px;
}

input[type=checkbox]#checkbox2:checked + label:before {
    content: '\f046';
}

input[type="checkbox"]:focus{
    outline: none;
}