使用属性“disabled”更改“选项”颜色 [英] Change the 'option' color with the attribute 'disabled'
本文介绍了使用属性“disabled”更改“选项”颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用属性 disabled
更改< option>
的字体颜色。
I would like to change the font color of an <option>
with the attribute disabled
.
我已尝试过
option:disabled { color: red }
和此
option[disabled] { color: red }
当您在选择字段上单击时会变为红色。默认为黑色。如何更改?
Both work but the color only gets red when you CLICK on the select field. By default it is black. How can I change it?
以下是一个示例: http: //jsfiddle.net/y0g0stbb/
推荐答案
尝试:
CSS:
select{
color:red;
}
option{
color:black;
}
这篇关于使用属性“disabled”更改“选项”颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文