1. Web setting placeholder
Set browser placeholder style
::-webkit-input-placeholder { /* WebKit browsers */
color: #999;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: #999;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
color: #999;
}
:-ms-input-placeholder { /* Internet Explorer 10+ */
color: #999;
}
2. WeChat applet setting placeholder
To set the placeholder style in a mini program, you need to use the built-in properties of the component. The placeholder style of input and textarea can be set in the following ways:
<!-- input组件 -->
<input placeholder-style="color:#999;font-size:14px;" />
<!-- textarea组件 -->
<textarea placeholder-style="color:#999;font-size:14px;"></textarea>
In the example above, the placeholder-style property is set to a string containing the CSS style. In this string, you can set any CSS style properties such as color, font size, font style, etc.
Note that these properties only apply to placeholder text, not the entered text. If you need to style input text, you should apply the style to the input box or text field itself.
3. Welcome exchanges and corrections
Reference link
Multiple ways of writing placeholder attribute styles_placeholder style_Li Meisi's blog-CSDN blog