我修改了项目中的复选框,使其与设计的其余部分看起来更加一致,但是我遇到了一个问题:每当选中该复选框的标签时都会稍微移动。自定义复选框在选中时会稍微移动
input[type="checkbox"] {
display: none !important;
}
input[type="checkbox"]+label:before {
position: relative;
content: " ";
display: inline-block;
width: 22px;
height: 22px;
border: 1px solid grey;
top: 4px;
margin: 0 10px 0 0;
}
input[type="checkbox"]:checked+label:before {
position: relative;
content: "✔";
display: inline-block;
width: 22px;
height: 22px;
border: 1px solid grey;
top: 4px;
margin: 0 10px 0 0;
}
<input type="checkbox" />
<label>Click to accept</label>
这里的结果:
下面是会发生什么,如果我选择它:
我在做什么错?