Stop Using :invalid and :valid Pseudo-Classes. Use THIS Instead!

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

Instead of using the :invalid and :valid CSS pseudo-classes on form inputs — which trigger immediately on page load before user interaction — you should use :user-invalid and :user-valid. These newer pseudo-classes only activate after the user has actually interacted with the input field, providing a better inline validation experience without needing JavaScript or workarounds like input:not(:placeholder-shown):invalid.

1m read timeFrom feedpress.me
Post cover image
1 Comment

Sort: