我試圖讓一封信是一個複選框,這樣當複選框被點擊時,複選框的背景會發生變化,但字母仍然存在。到目前爲止,我已經勾選了複選框來更改顏色,但無法將信件作爲背景。另外每個複選框將有不同的字母。HTML/CSS樣式複選框
.checkbox {
display: inline-block;
cursor: pointer;
font-size: 13px;
line-height: 18px;
}
input[type=checkbox] {
display: none;
}
.checkbox:before {
content: "";
display: inline-block;
width: 40px;
height: 40px;
vertical-align: middle;
text-align: center;
border-width: 5px;
border-style: solid;
border-radius: 25px;
}
input[type=checkbox]:checked+.checkbox:before {
background-color: red;
background-size: contain;
}
<input type="checkbox" id="checkbox">
<label class="checkbox" for="checkbox"></label>
<label>S</label>
你能提供您期望看到的圖像模型? –