Change an HTML input's placeholder color with CSS
Change an HTML input's placeholder color with CSS
664
24-Apr-2023
Updated on 25-Apr-2023
Aryan Kumar
25-Apr-2023You can change the color of an HTML input's placeholder text with CSS by using the ::placeholder pseudo-element. Here's an example:
In the above example, the placeholder text of the input will be displayed in red color. You can replace "red" with any other color of your choice. Note that not all browsers support this pseudo-element, so it's a good idea to test your code in different browsers to ensure consistent behavior.