Page 1 of 1
Change input placeholder style with CSS
Posted: 12 Jan 2015, 08:14
by PloMar
I have an input element with placeholder attribute, like this:
Code: Select all
<input type="text" name="yname" placeholder="Some text" />
How can i change the style of the placeholder text displayed in the input field, using CSS (color and font-weight)?
Change input placeholder style with CSS
Posted: 12 Jan 2015, 08:21
by MarPlo
This will style all input and textarea placeholders.
- Note:
Do not group these rules into a selector. Make a separate rule for every selector. Otherwise the whole group would be ignored by all browsers.
Code: Select all
*::-webkit-input-placeholder {
color: blue;
font-weight: 700;
}
*::-moz-placeholder {
/* FF 19+ */
color: blue;
font-weight: 700;
}
*:-ms-input-placeholder {
/* IE 10+ */
color: blue;
font-weight: 700;
}