How to style placeholder attribute across all browsers?

This question already has an answer here:

  • Change an HTML5 input's placeholder color with CSS 31 answers
  • Placeholder not working for Internet Explorer 8 answers

  • Placeholder text in inputs has (in the browsers implementing it so far) a light gray color. To style it, you'll need vendor prefix CSS properties.

    ::-webkit-input-placeholder {
       color: red;
    }
    
    :-moz-placeholder { /* Firefox 18- */
       color: red;  
    }
    
    ::-moz-placeholder {  /* Firefox 19+ */
       color: red;  
    }
    
    :-ms-input-placeholder {  
       color: red;  
    }
    

    You may also check this very similar question:

  • Change an HTML5 input's placeholder color with CSS
  • 链接地址: http://www.djcxy.com/p/12156.html

    上一篇: 用于占位符html的CSS颜色

    下一篇: 如何在所有浏览器中设置占位符属性的样式?