how to change the color of the placeholder of the input in html

This question already has an answer here:

  • Change an HTML5 input's placeholder color with CSS 31 answers

  • Here is jsFiddle for you. Solution

    You can use following css to implement the same

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

    You can use style to change the color of placeholder.

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

    Then in your css write-

    ::-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;
    }
    

    See the output in http://jsfiddle.net/w1wjo6q4/1/ Thanks & Regards

    链接地址: http://www.djcxy.com/p/12174.html

    上一篇: 我如何过渡高度:0; 到高度:auto; 使用CSS?

    下一篇: 如何在html中改变输入占位符的颜色