pseudo-element
::placeholder Pseudo-Element
Styles the placeholder text of input and textarea elements. Only a subset of CSS properties, primarily related to color and typography, apply.
::placeholder Example
input::placeholder { color: #999; font-style: italic; } /* Grey italic placeholder */ ✓ Matches
- <input placeholder="Email">
- <textarea placeholder="Message"></textarea>
- <input type="search" placeholder="Search">
✗ Does not match
- <input> with no placeholder attribute
- <div>hi</div> since it is not a form field
Browser support
Supported in all modern browsers since 2017.