Skip to content

CSS Selectors

Placeholder shown

About

The :placeholder-shown pseudo-class matches elements with a placeholder text that is currently visible.

Inputs with placeholder

Inputs with a placeholder match the selector.

Inputs with empty placeholder

Inputs with an empty placeholder attribute match the selector. Even if the user doesn't see a placeholder value (because it's empty), it's there.

Inputs without placeholder

Inputs without a placeholder don't match the selector because no placeholder is shown.

Inputs with value

Inputs with a value don't match the selector because the placeholder is not shown.

  • Delete the value to let the placeholder show up