为不同的浏览器特定选择器应用 css 规则

Applying css rule for different browser specific selectors

我想像这样跨多个浏览器定位占位符

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

但这不起作用

我必须为每个人单独做吗

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

html如下:

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

或者有其他方法吗?

(抱歉这个菜鸟问题)

谢谢!

用户代理需要忽略带有未知选择器的规则。

*包含无效选择器的一组选择器是无效的。

因此我们需要为每个浏览器制定单独的规则。否则整个组将被所有浏览器忽略。

检查这个答案