更改禁用的输入文本框的字体颜色?

编程入门 行业动态 更新时间:2024-10-23 23:21:57
本文介绍了更改禁用的输入文本框的字体颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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?

希望这有助于。

更多推荐

更改禁用的输入文本框的字体颜色?

本文发布于:2023-06-09 04:11:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/594984.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文本框   字体   颜色

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!