CSS - 为什么不能更改颜色的复选框无论我做什么? [英] css - Why Cannot Change Checkbox Color Whatever I Do?

查看:364
本文介绍了CSS - 为什么不能更改颜色的复选框无论我做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试风格复选框的背景颜色,但它不会改变不管我做什么。我使用Firefox的最新29

I try to style checkbox background color, but it won't change whatever I do. I am using firefox 29 latest.

有没有在CSS规则的一些变化,也可以在浏览器?

Is there some rule changes in css or may be in the browser?

CSS:

input[type="checkbox"] {
    background: #990000;    
}

.chk {
   background-color: #990000;  

}

下面是一个演示 http://jsfiddle.net/6KXRg/

推荐答案

复选框不能设置样式。你会需要一个第三方插件JS有许多可用的。

Checkboxes are not able to be styled. You would need a third party js plugin there are many available.

如果你想自己做它基本上​​包括隐藏复选框创建元素和造型是你想要的,然后它的Click事件绑定两个函数来改变它的外观,另一个激活复选框的Click事件。

If you want to do this yourself it basically involves hiding the checkbox creating an element and styling that as you want then binding its click event to two functions one to change its look and another to activate the click event of the checkbox.

试图样式下拉列表中选择元素上的小向下箭头时,也会出现同样的问题。

The same problem will arise when trying to style that little down arrow on a drop-down select element.

这篇关于CSS - 为什么不能更改颜色的复选框无论我做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆