I have an element like this <input type="text" placeholder="lorem ipsum">
.
How do I style thisplaceholder
attribute in CSS, so that it works across all browsers?
I have an element like this <input type="text" placeholder="lorem ipsum">
.
How do I style thisplaceholder
attribute in CSS, so that it works across all browsers?
Placeholder text in inputs has (in the browsers implementing it so far) a light gray color. To style it, you'll need vendor prefix CSS properties.
::-webkit-input-placeholder {
color: red;
}
:-moz-placeholder { /* Firefox 18- */
color: red;
}
::-moz-placeholder { /* Firefox 19+ */
color: red;
}
:-ms-input-placeholder {
color: red;
}
You may also check this very similar question: