思路: 把input的定位设为相对定位,通过将伪元素after设为绝对定位对input进行覆盖。 .checkbox{ width: .32rem; height: .32rem; position: relative; } .checkbox:after{ position: absolute; top:0; left: 0; content: ""; width: .32rem; height: .32rem; line-height: .32rem; background-color: #ffffff; color: #000000; display: inline-block; visibility: visible; border-radius: 3px; border: .01rem solid #000000; } .checkbox:checked:after{ content: "✓"; font-size: .4rem; text-align: center; }
结果图: