Change HTML5 input background color with inline CSS

Reading an SO publication Changing the color of HTML5 input code using CSS "I think I understand how to do this using external CSS.

Even after searching through Google and SO, I did not find a way to make this work with embedded CSS either (I know that embedded CSS should be avoided).

eg. sort of:

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

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

So my question is:

Can I use inline CSS to change the color of placeholder text? If so, how to do it?

+6
source share
1 answer

As far as I know, you certainly cannot. But you can do it 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; } 
0
source

Source: https://habr.com/ru/post/971695/


All Articles