:placeholder-shown

Term side of the Card
Topic: Pseudo Classes
Unit title: :placeholder-shown
Categories: Pseudo-class
Explanation side of the Card

Explanation: The pseudo-class that selects input or textarea elements when their placeholder text is visible. It can be used to apply styles when the placeholder is present, such as adjusting the background color or adding a border to indicate that the field is empty.

Browser compatibility:
  • The chrome browser supports this feature starting from version 47
  • The edge browser supports this feature starting from version 79
  • The firefox browser supports this feature starting from version 51
  • The safari browser supports this feature starting from version 9
Availability: