先设置checkbox基本属性,注意给checkbox的appearance设置为none
.itemCheck {
position: relative;
left: 10px;
top: 14px;
width: 25px;
height: 25px;
color: #fff;
outline: none;
background: #fff;
-webkit-appearance: none;
}
给checkbox添加伪元素设置边框圆角等:
.itemCheck::before {
content: '';
position: absolute;
top: -10px;
left: 0;
background: #fff;
color: #fff;
width: 100%;
height: 100%;
border-radius: 50%;
border: 1px solid #999;
}
设置checkbox选中状态下的样式:
.itemCheck:checked::before {
content: '\2713';
position: absolute;
top: -10px;
left: 0;
background: #fff;
color: green;
width: 100%;
height: 100%;
border-radius: 50%;
border: 1px solid skyblue;
text-align: center;
font-size: 20px;
}