20

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?

Community
  • 1
  • 1
Uwe Keim
  • 39,551
  • 56
  • 175
  • 291

1 Answers1

10

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;
}
Mohamed El Mahallawy
  • 13,024
  • 13
  • 52
  • 84