This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The ::placeholder
CSS pseudo-element represents the placeholder text of a form element.
::placeholder { color: blue; font-size: 1.5em; }
Only the subset of CSS properties that apply to the ::first-line
pseudo-element can be used in a rule using ::placeholder
in its selector.
Note: In Firefox, the appearance of placeholder text is a translucent gray color by default.
::placeholder
<input placeholder="Type something here!">
input::placeholder { color: red; font-size: 1.2em; font-style: italic; }
Specification | Status | Comment |
---|---|---|
CSS Pseudo-Elements Level 4 The definition of '::placeholder' in that specification. | Working Draft | Initial definition. |
:placeholder-shown
pseudo-class styles an element that has an active placeholder.<input>
, <textarea>
::-webkit-input-placeholder
, ::-moz-placeholder
, :-ms-input-placeholder
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/::placeholder