Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

This question already has an answer here:

Reading the SO posting "Change an input's HTML5 placeholder color with CSS" I think I understand how to do it with an external CSS.

Even after searching through Google and SO I found no way to make this also work with inline CSS (I'm aware that inline CSS should be avoided).

E.g. something like:

<input type="text" placeholder="Enter something" style="???" />

For the ??? part I have no idea what to enter in order to change the color of the placeholder text.

So my question is:

Is it possible to use inline CSS to change the color of a placeholder text? If yes, how to do it?

share|improve this question

marked as duplicate by Quentin Jul 3 at 6:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

As far as I know, you certainly cannot. But you can do this with css

input::-webkit-input-placeholder { /* WebKit browsers */
    color:    #fff;
}
input:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
    color:    #fff;
}
input::-moz-placeholder { /* Mozilla Firefox 19+ */
    color:    #fff;
}
input:-ms-input-placeholder { /* Internet Explorer 10+ */
    color:    #fff;
}
share|improve this answer
    
Thanks. That's what the linked article also suggest, right? –  Uwe Keim Jul 3 at 6:03
1  
Yep thats the same :D –  Mohamed El Mahallawy Jul 3 at 6:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.