0

I'm trying to style a placeholder for input text in Chrome v42 Why does the following code not work in the latest version of Chrome?

Or rather what is the fix?

https://jsfiddle.net/5osszauf/

Note: I'm fully aware there's cross browser CSS. Please ignore.

<input type="text" placeholder="fefg3f">

input::-webkit-input-placeholder, input:focus::-webkit-input-placeholder, input:focus:-moz-placeholder, input:focus::-moz-placeholder, input:focus:-ms-input-placeholder {
            color: #000;
        }

EDIT: I took the code from the stackoverflow post

How to change placeholder color on focus?

If in answer is provided it might be worth updating the answer for this post also?

Community
  • 1
  • 1
lejimmie
  • 378
  • 3
  • 15

2 Answers2

0

If you have a list of comma seperated selectors like that and a browser doesn't recognise even one of those selectors it will ignore all selectors in that list.

In your example, the -moz prefix for Firefox will not be recognised by Chrome.

The fix is to create separate rules for each different prefix.

Shaggy
  • 6,696
  • 2
  • 25
  • 45
0

I think this code will work:

input[type="text"]::-webkit-input-placeholder {
   color: #fff;
}
shA.t
  • 16,580
  • 5
  • 54
  • 111
Alias Varghese
  • 2,104
  • 3
  • 24
  • 52