Style text input placeholder

Possible Duplicate:
Change an input's HTML5 placeholder color with CSS

Is there anyway to style the color of a placeholder in a text input? Right now I'm stuck with the boring default grey.


You sure can http://css-tricks.com/snippets/css/style-placeholder-text/.

(from the above article)

::-webkit-input-placeholder {
    color: red;
}

:-moz-placeholder { /* Firefox 18- */
    color: red;  
}

::-moz-placeholder {  /* Firefox 19+ */
    color: red;  
}

:-ms-input-placeholder {  
   color: red;  
}

Or check MDN https://developer.mozilla.org/en-US/docs/CSS/:-moz-placeholder

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

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

下一篇: 样式文本输入占位符