To change the placeholder text color of a input
element in HTML5, you can use the ::placeholder
pseudo-element and the color
property in CSS, like this:
input::placeholder { color: red; }
This will change the color of the placeholder text to red for all input
elements on the page.
You can also use the ::placeholder
pseudo-element to style other aspects of the placeholder text, such as the font size and font family:
input::placeholder { color: red; font-size: 20px; font-family: sans-serif; }
Keep in mind that the ::placeholder
pseudo-element is not supported in all browsers. If you need to support older browsers, you can use a JavaScript solution to change the placeholder text color.