[英]Styling checkbox without a label
在CSS中,隨處可見input[type=checkbox]:not(old):checked + label
,因此,如果刪除label
,將不會使用CSS。 因此,要么更改CSS,要么將標簽留空- <label for="XYZ"></label>
。
編輯
因此,只需添加min-width
和height
屬性:
input[type=checkbox]:not(old) + label,
input[type=radio ]:not(old) + label{
height: 45px;
min-width: 45px;
}
如果只想使用輸入,還可以使用apperance
屬性設置樣式復選框。 但是,它不適用於IE。
input[type="checkbox"] {
-webkit-appearance: none;
-moz-appearance: none;
box-sizing: borer-box;
width: 100px;
height: 30px;
cursor: pointer;
background: url(//dummyimage.com/100x30/000/ffffff&text=click+me);
}
input[type="checkbox"]:checked {
background: url(//dummyimage.com/100x30/0e7d0e/ffffff&text=checked);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.