.txt1::-webkit-input-placeholder::before {
color:#c2c3c3;
content:"Hey Brad,\A Tell us what's on your mind";
}
.txt1::-moz-input-placeholder::before {
color:#c2c3c3;
content:"Hey Brad,\A Tell us what's on your mind";
}
占位符在 Firefox 中不工作,Chrome 中很好
最佳答案
Webkit 使用 ::-webkit-input-placeholder
定位占位符文本:
.txt1::-webkit-input-placeholder:before {
color:#c2c3c3;
content:"Hey Brad,\A Tell us what's on your mind";
}
虽然 Firefox 使用 :-moz-placeholder
来定位占位符文本:
.txt1:-moz-placeholder:before {
color:#c2c3c3;
content:"Hey Brad,\A Tell us what's on your mind";
}
您已经将 input
添加到 Firefox 的选择器中,这不是必需的。对于 Firefox,您应该只在选择器的开头包含一个冒号,而不是两个。我还建议删除选择器 ::before
之后的多余冒号并将其更改为 :before
因为这些是不必要的。使用我上面的代码示例,你应该会很好。希望这可以帮助!如果您有任何问题,请告诉我。
来源:https://developer.mozilla.org/en-US/docs/CSS/:-moz-placeholder
关于jquery - 占位符在 Firefox 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13392299/