The placeholder attribute

placeholder shows an example hint inside an empty field, which disappears once text is entered.

Applies to

input, textarea

Values

Free short example text.

Example

<input type="email" placeholder="you@example.com">

Edge cases

  • placeholder disappears as soon as the field is focused/filled — the user loses the hint right when they need it, which makes it a poor substitute for an always-visible label.
  • Placeholder text often has lower contrast than regular text in many browsers — a potential accessibility issue.

Accessibility

  • placeholder does NOT replace a label — always add a separate label even when a placeholder is present.

Related tools