【问题标题】:how to change the color of the placeholder of the input in html [duplicate]如何更改html中输入占位符的颜色[重复]
【发布时间】:2015-03-23 23:19:40
【问题描述】:

我想更改文本字段占位符的颜色。这是我的代码。提前致谢

<input type="text" placeholder="input here"/>

【问题讨论】:

    标签: html


    【解决方案1】:

    这是适合您的 jsFiddle。 Solution

    你可以使用下面的css来实现同样的

    ::-webkit-input-placeholder { /* WebKit browsers */
      color:    #909;
    }
    :-moz-placeholder {
      color:    #999;
    }
    ::-moz-placeholder {
      color:    #999;
    }
    :-ms-input-placeholder {
      color:    #999;
    }
    

    【讨论】:

      【解决方案2】:

      您可以使用样式来更改占位符的颜色。

      <input type="text" placeholder="input here" />
      

      然后在你的css中写-

      ::-webkit-input-placeholder { /* WebKit browsers */
          color:    Red;
      }
      :-moz-placeholder { /* Mozilla Firefox 4 to 18 */
          color:    Red;
          opacity:  1;
      }
      ::-moz-placeholder { /* Mozilla Firefox 19+ */
          color:   Red;
          opacity:  1;
      }
      :-ms-input-placeholder { /* Internet Explorer 10+ */
          color:    Red;
      }
      

      查看http://jsfiddle.net/w1wjo6q4/1/中的输出 感谢和问候

      【讨论】:

        猜你喜欢
        • 2018-04-12
        • 2017-01-26
        • 1970-01-01
        • 2020-04-19
        • 2013-03-08
        • 2014-08-24
        • 2013-05-12
        • 2015-01-12
        • 2016-02-25
        相关资源
        最近更新 更多