Learn how to change the color of the placeholder attribute with CSS.
Use an input element and add the placeholder attribute:
<input type="text" placeholder="A red placeholder text..">
In most browsers, the placeholder text is grey. To change this, style the placeholder with the ::placeholder
selector. Note that Firefox adds a lower opacity to the placeholder, so we use opacity: 1
to fix this.
::placeholder {
color: red;
opacity: 1; /* Firefox */
}
::-ms-input-placeholder { /* Edge 12 -18 */
color: red;
}
Try it Yourself »
Tip: Read more about the ::placeholder selector in our CSS Reference: CSS ::placeholder selector.
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!