You can change the color of an HTMLinput's placeholder text with CSS by using the ::placeholder pseudo-element. Here's an example:
<input type="text" placeholder="Enter your text here">
/* Change the color of the input's placeholder text */
input::placeholder {
color: red;
}
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.
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
You 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.