Change input placeholder style with CSS

Place to talk about website HTM elements, CSS style and design, and get help with HTML, CSS codes.
PloMar
Posts: 48

Change input placeholder style with CSS

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)?

MarPlo Posts: 186
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;
}

Similar Topics