css - 输入[类型="text"]:disabled not working for IE

标签 css

我想在禁用控件时更改其背景颜色。为此,我正在使用:

在CSS文件中

 input[type="text"]:disabled{background:red;} 

在 Html 文件中

<input tyepe="text" disabled="" >

它在 Chrome 和 Mozilla 上正常工作,但在 Internet Explorer 中无法工作。

我该如何解决这个问题。

谢谢。

最佳答案

只有 IE9+ 支持 :disabled 伪选择器,如 MSDN文档。 IE7+ 支持 CSS 属性选择器:

input[type="text"][disabled] {
  background: red;
}

关于css - 输入[类型="text"]:disabled not working for IE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17809321/

相关文章:

javascript - fa fa-search 在 mac 和 iPhone 中无响应

CSS定位,在流体布局中覆盖div

html - html/css id 和类的标准命名约定是什么?

html - 如何让我的导航按钮保持事件状态

html - css 不适用

javascript - 在不调整图像大小的情况下更改图像的可点击区域

c# - 如何在 windows.print 上分页

jquery - 随着浏览器大小的变化缩放 div 内的图像

html - Owl Carousel : first slide not trigger action

css - Internet Explorer 吞噬事件