更改禁用的输入文本框的字体颜色? [英] Change the font color of disabled input text box?

查看:131
本文介绍了更改禁用的输入文本框的字体颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问:是否可以更改禁用的输入框的字体?

Q: Is it possible to change the font of a disabled input box?

在IE8 / 9中,它显示为浅灰色,几乎不可读。 Chrome和Firefox很好(当然)。我试图将CSS样式设置为颜色:#000!重要,但它仍然非常浅灰色。

In IE8/9 it shows up as light gray and is barely readable. Chrome and Firefox are fine (of course). I have tried to set the css style to color: #000 !important but it's still very light gray.

<input class="TextBoxAsLabel" data-val="true" data-val-number="blah" disabled="disabled" id="Total" name="XTotal" type="text" value="$0.00" />


推荐答案

没有办法 - 虽然是将输入更改为只读:

There is no way to do it - what you can do instead though is change the input to readonly:

<input class="TextBoxAsLabel" data-val="true" data-val-number="blah" readonly="readonly" id="Total" name="XTotal" type="text" value="$0.00" />

这将为您禁用功能,但保留样式:)

This will give you the disabled functionality but preserve styling :)

有关详情,请参阅此信息:如何更改禁用输入中的字体颜色?

See this post for more details: How to change font-color in disabled input?

希望这有助于。

这篇关于更改禁用的输入文本框的字体颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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