需要将checkbox的样式重新定义。原理是利用 input:checked + 元素
例如:
HTML:
<label class="mycheckbox">
<input type="checkbox" name="doc-radio-1" value="option1" >
<b id="checkboxB"></b>
</label>
CSS:
.mycheckbox input{ display:none}
.mycheckbox b{
background:url(../images/nochecnon.png) no-repeat;
background-size:cover !important;
width: 2rem;
height: 2rem;
float:left;
}
.mycheckbox input:checked + b{
background:url(../images/checnon.png) no-repeat;
background-size:cover !important;
width: 2rem;
height: 2rem;
background-size:38rem 34rem;
}