Html 启用时更改复选框颜色
我有下面的复选框,当复选框被选中时我需要它 检查了V的颜色是否为绿色,我该怎么做Html 启用时更改复选框颜色,html,asp.net,css,Html,Asp.net,Css,我有下面的复选框,当复选框被选中时我需要它 检查了V的颜色是否为绿色,我该怎么做 <input type="checkbox" checked="checked" disabled="disabled" /> 这不起作用 <style type="text/css"> input[type=checkbox], input[type=file] { display: inline-block; margin-right: 1
<input type="checkbox" checked="checked" disabled="disabled" />
这不起作用
<style type="text/css">
input[type=checkbox], input[type=file] {
display: inline-block;
margin-right: 15px;
}
input[type="checkbox"]:disabled:checked + label::after {
border: 3px solid #228B22;
border-top: none;
border-right: none;
}
input[type="checkbox"]:checked + label::after {
content: '';
position: absolute;
width: 1.2ex;
height: 0.4ex;
background: rgba(0, 0, 0, 0);
top: 0.9ex;
left: 0.4ex;
border: 3px solid #1062a4;
border-top: none;
border-right: none;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
</style>
输入[类型=复选框],输入[类型=文件]{
显示:内联块;
右边距:15px;
}
输入[type=“checkbox”]:禁用:选中+标签::之后{
边框:3px实心#228B22;
边界顶部:无;
边界权:无;
}
输入[type=“checkbox”]:选中+标签::之后{
内容:'';
位置:绝对位置;
宽度:1.2倍;
高度:0.4ex;
背景:rgba(0,0,0,0);
顶部:0.9ex;
左:0.4ex;
边框:3px实心#1062a4;
边界顶部:无;
边界权:无;
-webkit变换:旋转(-45度);
-moz变换:旋转(-45度);
-o变换:旋转(-45度);
-ms变换:旋转(-45度);
变换:旋转(-45度);
}
更新*
我编辑小提琴,这是您所需要的(启用=绿色,禁用它):
例如,请参见此答案,但要了解更多控件和样式,请搜索jQuery插件。您是否理解OP的问题?这里是(非常清楚)我需要的是,当复选框被选中时,V的颜色将为绿色谢谢,但这不起作用,V标记没有改变他的颜色…还有其他想法吗?嗨,Riskbreaker,我已经将它添加到我的css文件中的编辑操作文件中,如follow post,尽管我看到它在小提琴中,但它不起作用,你知道问题出在哪里,或者如何调试吗?请看我的更新帖子,谢谢!顺便说一句,你能把你的加入小提琴吗?您是否也在添加位置元素?
input[type="checkbox"]:disabled:checked + label::after {
border: 3px solid #228B22;
border-top: none;
border-right: none;
}
input[type="checkbox"]:checked + label::after {
content: '';
position: absolute;
width: 1.2ex;
height: 0.4ex;
background: rgba(0, 0, 0, 0);
top: 0.9ex;
left: 0.4ex;
border: 3px solid #1062a4;
border-top: none;
border-right: none;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}