我已经使用教程开发了一个自定义复选框。代码如下。
小提琴
的HTML
<input type="checkbox" name="checkboxG1" id="checkboxG1" class="css-checkbox" />
<label for="checkboxG1" class="css-label"></label>
的CSS
input[type=checkbox].css-checkbox {
display:none;
}
input[type=checkbox].css-checkbox + label.css-label {
padding-right: 20px;
height: 14px;
display: inline-block;
line-height: 14px;
background-repeat: no-repeat;
background-position: 0px 0;
font-size: 14px;
vertical-align: middle;
cursor: pointer;
}
input[type=checkbox].css-checkbox:checked + label.css-label {
background-position: 0px -14px;
}
label.css-label {
background-image:url(http://csscheckbox.com/checkboxes/u/csscheckbox_39e0df4737b77a2ca4a672a70ec70e86.png);
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
我正在尝试将上述CSS插入控制器使用高度自定义的现有应用程序中。
的HTML
<input type="checkbox" id="chkincShowCancel" class="css-checkbox" name="incShowCancel" checkedValue="1" onclick="this.value = (this.checked==true ? 1 : 0)" style="border: 0;"/>
<label for="checkbox" class="css-label"></label>
但是已检查/未检查的更改不会受到css的影响。任何帮助。
将您的标签更改为此
<label for="chkincShowCancel" class="css-label"></label>
id
复选框for
的标签和标签的标签应相同
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句