原生的checkbox样式不太好看,可以借用CSS改变标签样式,达到看似复选框的效果。
<style type="text/css">
/********checkbox样式************/
.demo-radio {
display:none
}
.demo-radioInput {
background-color:#fff;
border:1px solid rgba(0,0,0,0.15);
border-radius:100%;
display:inline-block;
height:14px;
margin-right:10px;
margin-top:-1px;
vertical-align:middle;
width:14px;
line-height:1
}
.demo-radio:checked + .demo-radioInput:after {
background-color:#da7606;
border-radius:100%;
content:"";
display:inline-block;
height:10px;
margin:2px;
width:10px
}
.demo-checkbox.demo-radioInput,.demo-radio:checked + .demo-checkbox.demo-radioInput:after {
border-radius:0
}
/********checkbox样式************/
</style>
<label>
<input type="checkbox" class="demo-radio" name="item"><span class="demo-checkbox demo-radioInput"></span>苹果
</label>
<label>
<input type="checkbox" class="demo-radio" name="item"><span class="demo-checkbox demo-radioInput"></span>香蕉
</label>
<label>
<input type="checkbox" class="demo-radio" name="item"><span class="demo-checkbox demo-radioInput"></span>西瓜
</label>
效果: