我正在开发一个项目,其中占位符颜色由开发人员全局定义.但是现在我需要为具有不同占位符颜色的表单设置样式.我该如何正确处理?
CSS
::-webkit-input-placeholder {
color: red;
}
:-moz-placeholder {
color: red;
}
::-moz-placeholder {
color: red;
}
:-ms-input-placeholder {
color: red;
}
.box input::-webkit-input-placeholder, .box textarea::-webkit-input-placeholder {
color: blue;
}
.box input:-moz-placeholder, .box textarea:-moz-placeholder {
color: blue;
}
.box input:-ms-input-placeholder, .box textarea:-ms-input-placeholder{
color: blue;
}
Run Code Online (Sandbox Code Playgroud)
Fil*_*ans 18
试试这段代码:
你在哪里关闭只需要在前面添加.box,如:
.box::-moz-placeholder
Run Code Online (Sandbox Code Playgroud)
干杯