【问题标题】:IE 11 doesn't render placeholder color properlyIE 11 无法正确呈现占位符颜色
【发布时间】:2015-05-25 22:11:50
【问题描述】:

在 Bootstrap 3.2.2 中有声明:

.form-control:-ms-input-placeholder {
  color: #999;
}

IE 11.0.17(可能还有其他版本)无法正确呈现它,占位符保持黑色。

【问题讨论】:

    标签: css twitter-bootstrap internet-explorer placeholder html-rendering


    【解决方案1】:

    我在我的自定义 CSS 中添加了以下内容,它解决了问题:

    input:-ms-input-placeholder {
        color: #999;
    }
    
    【解决方案2】:

    Internet Explorer 11 需要 !important 标志来覆盖默认的用户代理样式。

    .form-control:-ms-input-placeholder {
      color: #999 !important;
    }
    

    在使用 ::-ms-input-placeholder 且没有 !important 标志的 Microsoft Edge 中,这不是问题。 Internet Explorer 10 不需要!important 标志。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-06
      • 2020-01-19
      • 2019-04-04
      • 2017-06-28
      • 2010-09-23
      • 1970-01-01
      • 2017-01-09
      • 1970-01-01
      相关资源
      最近更新 更多