禁用文本框中的 HTML 文本颜色
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4533810/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HTML text color in disabled text box
提问by sikas
I have a text boxin html, I have set the text boxto disabled,
我text box在 html 中有一个,我已将其设置text box为disabled,
<input type="text" style="background-color:transparent; text-align:center" disabled="disabled" />
So the text color in this text boxis gray, how can I change it to any color I want?
所以这里的文字颜色text box是灰色的,我怎样才能把它改成我想要的任何颜色?
回答by ajreal
color:xxxand provide some value for the textbox
color:xxx并为文本框提供一些值
<input type="text" style="background-color:transparent; color:red;
text-align:center" disabled="disabled" value="some values"/>
work for chrome, firefox, except internet explorer
适用于 chrome、firefox,但 Internet Explorer 除外
回答by Aravind Yarram
You can try with css selectorsas shown below but as "Sarfarz" mentioned browsers might or might not honor this. But you can test
您可以尝试使用如下所示的css 选择器,但正如“Sarfarz”提到的浏览器可能会或可能不会尊重这一点。但是你可以测试
input[disabled='disabled']
{
...styles
}
回答by miqbal
It's possible.
这是可能的。
input:disabled {
background: #000;
}

