我想用我自己的图像来设置我的复选框样式,但我的工作原理是,原始复选框仍然可见。所以标准复选框在自定义复选框旁边,并且链接在一起。使用CSS样式时复制复选框
HTML
<div class="amPmCheckbox">
<input type="checkbox" name="data[Child][remember_me]" class="checkboxLabel main_street_input" id="am_2" value="1" />
<label for="am_2">AM</label>
CSS
/*CHECBOX STYLING*/
.amPmCheckbox input [type="checkbox"] {
display:none;
}
.amPmCheckbox input[type="checkbox"]+label {
background: url('http://renegadeox.com/img/off.png') no-repeat;
height:17px;
padding-left: 18px;
}
.amPmCheckbox input[type="checkbox"]:checked + label {
background: url('http://renegadeox.com/img/on.png') no-repeat;
height:17px;
}
这里是工作的例子。