How to change input's placeholder color with CSS
The default color of a input's placeholder text is light grey in most browsers. Sometimes, we want to change the default color. If you are thinking about that, in this article I shall explain how you can change the placeholder color .
Change input placeholder text color using css
Try it Yourself »
- Create an input element with a placeholder attribute.
- Inside the <style> style the placeholder with ::placeholder pseudo class.
<input type="text" placeholder="Enter Your Name"/>
<style> ::placeholder{ color:red; } </style>
To change the placeholder text opacity, use opacity:0.5 property. If you want to change the placeholder background color, border etc., you can also do that.
Don't forget to remember that for each browser there is a different way to implement. For example
::-webkit-input-placeholder Safari, Google Chrome.
::-ms-input-placeholder Microsoft Edge, Internet Explorer.
::placeholder all modern browsers support this.
::-webkit-input-placeholder Safari, Google Chrome.
::-ms-input-placeholder Microsoft Edge, Internet Explorer.
::placeholder all modern browsers support this.
save
listen
AI Answer
How to change input's placeholder color with CSS
0
The default color of a input's placeholder text is light grey in most browsers. Some…
asked
Apu
0 answers
2915
The default color of a input's placeholder text is light grey in most browsers. Some…
Answer Link
answered
Apu