JSFiddle - React, Tailwind, and code Playground
HTML
<div class="checkbox">
<input id="checkbox-1" type="checkbox" name="Data1" value="option1" />
<label for="checkbox-1">HTML</label>
<br />
<input id="checkbox-2" type="checkbox" name="Data2" value="option2" />
<label for="checkbox-2">CSS</label>
<br />
<input id="checkbox-3" type="checkbox" name="Data3" value="option3" />
<label for="checkbox-3">HTML</label>
<br />
<input id="checkbox-4" type="checkbox" name="Data4" value="option4" />
<label for="checkbox-4">CSS</label>
</div>
CSS
label {
display: inline-block;
cursor: pointer;
position: relative;
padding-left: 28px;
margin-right: 12px;
font-size: 16px;
line-height: 22px;
font-weight: bold;
}
input[type=radio], input[type=checkbox] {
display: none;
}
label:before {
font-weight: normal;
content: '';
display: inline-block;
width: 18px;
height: 18px;
margin-right: 10px;
position: absolute;
left: 0;
bottom: 1px;
/*background-color: #1ABFE5;*/
background: url('http://cnt.in.bookmyshow.com/bmsin/SLIMG/1_1.gif?v1');
/*box-shadow: inset 0px 2px 3px 0px #10758C;*/
}
.radio label:before {
/*border-radius: 10px;*/
}
.checkbox label:before {
/*border-radius: 3px;*/
}
input[type=radio]:checked + label:before {
content: '';
color: #f3f3f3;
font-size: 32px;
text-align: center;
line-height: 20px;
background: url('http://cnt.in.bookmyshow.com/bmsin/SLIMG/1_4.gif');
}
input[type=checkbox]:checked + label:before, input[type=checkbox] + label:hover:before{
content: '';
text-shadow: 1px 1px 1px #10758C;
font-size: 24px;
color: #f3f3f3;
text-align: center;
line-height: 24px;
background: url('http://cnt.in.bookmyshow.com/bmsin/SLIMG/1_4.gif');
}
.checkbox{
background:red;
}
JavaScript
$('.checkbox').click(function(){
var el = $('.checkbox input[type=checkbox]')
if(el.is(':checked')){
find(el).removeAttr('checked');
}
else {
el.attr('checked','checked');
}
});