The placeholder pseudo-element
The placeholder pseudo-element sets
styles for
placeholder
hint in the
input
or textarea
tags.
Syntax
cssselector::placeholder {
color: red;
}
Example
Let's color the hint red:
html<input type="text" placeholder="hint">cssinput::placeholder {
color: red;
}
Результат:
Example . Hint in textarea
Let's color the hint red in the
textarea
tag:
html<textarea placeholder="hint"></textarea>csstextarea::placeholder {
color: red;
}
Результат:
See also
-
attribute
placeholder,
which sets the hint for the input field -
pseudo-class
placeholder-shown,
which sets the styles for the input field with the hint