问题:
Chrome supports the placeholder attribute on input[type=text] elements (others probably do too). Chrome支持input[type=text]元素的占位符属性 (其他人也可能这样做)。
But the following CSS doesn't do anything to the placeholder's value: 但是以下CSS对占位符的值没有任何作用:
input[placeholder], [placeholder], *[placeholder] { color: red !important; }
<input type="text" placeholder="Value">
Value will still remain grey instead of red . Value仍然是grey而不是red 。
Is there a way to change the color of the placeholder text? 有没有办法改变占位符文本的颜色?
解决方案:
参考一: https://stackoom.com/question/Ax6n/使用CSS更改HTML-输入的占位符颜色参考二: https://oldbug.net/q/Ax6n/Change-an-HTML5-input-s-placeholder-color-with-CSS
来源:oschina
链接:https://my.oschina.net/stackoom/blog/4294608