placeholder

The placeholder attribute shows hint text inside an empty input or textarea.

Since HTML5 Spec ↗

Syntax

placeholder="hint"

Examples

<input type="search" placeholder="Search docs...">
Output
Renders a search field showing faint "Search docs..." text until the user types.

Notes

Placeholder is not a label and disappears on input, so it must not replace a visible <label>. Keep it short; long placeholders harm accessibility and contrast.

Browser & runtime support

EnvironmentSince version
chrome 10
firefox 4.0
safari 5.0
edge 12

See also