1

I want to target the placeholder across multiple browsers like this

.editor textarea::-webkit-input-placeholder, 
.editor textarea:-moz-placeholder, 
.editor textarea::-moz-placeholder, 
.editor textarea:-ms-input-placeholder
{
    color: red;
}

but this does not work

Do I have to do it separately for each

.editor textarea:-ms-input-placeholder
{
    color: red;
}

The html is as follows:

<div class="editor">
<textarea placeholder="This will be the heading sentence..."></textarea>
</div>

or is there another way?

(sorry for the noob question)

Thanks!

jacobdo
  • 1,605
  • 3
  • 15
  • 34

1 Answers1

2

User agents are required to ignore a rule with an unknown selector.

*a group of selectors containing an invalid selector is invalid.

So we need separate rules for each browser. Otherwise the whole group would be ignored by all browsers.

Check this answer https://stackoverflow.com/a/2610741/5794995

Community
  • 1
  • 1