【问题标题】:Can I select all elements with a specific class and set the readonly attribute to true in CSS我可以选择具有特定类的所有元素并在 CSS 中将 readonly 属性设置为 true
【发布时间】:2015-01-19 12:45:22
【问题描述】:

我的文本输入很少,我想通过 CSS 将它们设为只读,但不是:

readonly: "readonly" inlined

我检查了这个话题:

How to style readonly attribute with CSS?

但它对我不起作用。

我试过这样:

input.my-class[readonly]
{
}

以及 readonly="readonly" 等的所有变体,但它根本不起作用。

【问题讨论】:

  • 你能给我们看看 HTML 代码吗?您正在尝试的可能有另一种选择..

标签: css input textbox readonly


【解决方案1】:

CSS 不能设置任何 html 属性。

CSS 只能样式它们。

【讨论】:

  • 名字里有啊 ;)?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-08-08
  • 2022-01-03
  • 2012-02-24
  • 1970-01-01
相关资源
最近更新 更多