Stop Using :valid in Your Forms — Try This New CSS Feature Instead

If you’re a web developer like me, you’ve probably styled a form before. And if you’re anything like me, you’ve tried to be helpful — maybe you added some color changes with input:valid or input:invalid, outlined fields, maybe even threw in a little transition effect. But then this came to your mind: Wait, why is this field showing up as valid before the user even typed anything?

May 17, 2025 - 17:04
 0
Stop Using :valid in Your Forms — Try This New CSS Feature Instead

If you’re a web developer like me, you’ve probably styled a form before.

And if you’re anything like me, you’ve tried to be helpful — maybe you added some color changes with input:valid or input:invalid, outlined fields, maybe even threw in a little transition effect.

But then this came to your mind: Wait, why is this field showing up as valid before the user even typed anything?