我正在使用此 HTML 为我自己交换浏览器复选框
input[type="checkbox"] {
display: none;
width: 30px;
&+label {
width: 30px;
&::before {
display: inline-block;
width: 30px;
height: 26px;
margin: 0px;
vertical-align: middle;
background: url(../images/tick.png) -30px top no-repeat;
cursor: pointer;
content: "";
}
}
&:checked+label::before {
background: url(../images/tick.png) left top no-repeat;
}
}
<input required type="checkbox" id="acceptance" name="acceptance" value="yes"><label for="acceptance"></label>