标签
<input type="checkbox" id="checked"/> <span>请选择</span>
css样式
使用after伪类选择器
#checked[type=checkbox] {
position: relative;
width: 16px;
height: 16px;
cursor: pointer;
}
#checked[type=checkbox]::after {
position: absolute;
top: 0;
color: #000;
width: 16px;
height: 16px;
display: inline-block;
visibility: visible;
padding-left: 0px;
text-align: center;
content: ' ';
border-radius: 3px
}
#checked[type=checkbox]:checked::after {
content: "✓";
color: #fff;
font-size: 12px;
line-height: 16px;
font-weight: bold;
background-color: red;
}
结尾处,欢迎交流学习,纠错。