:placeholder-shown CSS pseudo-classExternal Link

BaselineWidely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2022.

Input elements can sometimes show placeholder text as a hint to the user on what to type in. See, for example, the placeholder attribute in HTML5. The :placeholder-shown pseudo-class matches an input element that is showing such placeholder text.

IE
Edge
Firefox
Chrome
Safari
Safari iOS
Opera Mini
Chrome Android
Android Browser
Samsung Internet
Globals: 97.56% of all users can use this feature, 97.39% fully supported, 0.17% partially supported
✓Supported
✗Not supported
Partial support
Prefixed