【问题标题】:disabled text input not styling禁用文本输入而不是样式
【发布时间】:2015-10-22 20:46:51
【问题描述】:

我有一个带有禁用文本输入字段的表单,我想将其设置为看起来正常但不允许输入。

在 Chrome 中有效,但在 FireFox 或 IE 中无效 - 这可以在 FF/IE 中完成吗?

HTML:

<input type="text" value="test" disabled />

CSS:

input[type="text"][disabled] {
    background-color: #f00;
}

【问题讨论】:

标签: html css


【解决方案1】:

你可以这样做:

input[type="text"][disabled],
input[type="text"]:disabled {
    color: #ff0;
    background-color: #f00;
}
&lt;input type="text" value="test" disabled /&gt;

JSFiddle:http://jsfiddle.net/jonsuh/brbktnvv/

【讨论】:

  • 在 Chrome 中运行良好,在 IE11/FF 中无法运行。这正常吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2010-10-16
  • 2017-08-09
  • 2021-02-22
  • 2019-08-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多