來(lái)CSDN的處女問(wèn)呢:
故事起因于我要單純地用css自定義一個(gè)checkbox的樣式,然后我是這樣做的:
<input id = "my-checkbox" type = "checkbox"/><label for = "my-checkbox"></label>
input[type="checkbox"]{opacity:0;}input[type="checkbox"] + label:before{background:#d5d5d5; content:""; height: 15px; width: 15px; position: absolute; top: 0; left: 0; }
以上方法我是效仿iCheck插件寫的。BUT導(dǎo)師說(shuō)我的方法不行?。ㄋぃ。?
他說(shuō):id 濫用會(huì)導(dǎo)致日后id重名排查困難,讓我用把
包裹在