Change an input's HTML5 placeholder color with CSS

Posted by David Murdoch on Stack Overflow See other posts from Stack Overflow or by David Murdoch
Published on 2010-04-09T19:54:53Z Indexed on 2010/04/09 20:03 UTC
Read the original article Hit count: 650

Filed under:
|
|

Chrome supports the placeholder attribute on input[type=text] elements (others probably do too).

But the following CSS doesn't do diddly squat:

<style>
    input[placeholder], [placeholder], *[placeholder]
    {
        color:red !important;
    }
</style>
<input type="text" placeholder="Value" />

"Value" will still be grey (er, gray. whatever) instead of red.

Is there are way to change the color of the placeholder text?

p.s. I'm already using the jQuery placeholder plugin for the browsers that don't support the placeholder attribute natively.

© Stack Overflow or respective owner

Related posts about css

Related posts about html5