CSS :user-valid Pseudo-Class

Beginner
2 examples
Updated: Nov 2026

Definition and Usage

The :user-valid pseudo-class matches a form control that is valid after the user has interacted with it. Unlike :valid, empty required fields do not look valid on page load.

CSS Syntax

syntax.css
input:user-valid {
  border-color: #16a34a;
}

Key Uses

PatternPurposeTry it
:user-validValid after user interactionTry it
vs :valid:valid can match before the user typesTry it

CSS Examples

Success only after typing

example.css
input:user-valid {
  outline: 2px solid #16a34a;
}
Try It Yourself

Browser Support

:user-valid is a CSS selector.

✓ Selectors

:user-valid

Supported in modern browsers.

94% Modern browsers
Google Chrome Recent
Full support
Mozilla Firefox Recent
Full support
Apple Safari Recent
Full support
Microsoft Edge Recent
Full support
:user-valid Modern support

Bottom line: Safe for modern sites. Keep readable defaults without the selector.

Frequently Asked Questions

:valid can match immediately. :user-valid waits until the user has interacted.
It avoids green success styles on untouched empty fields.
No. The browser tracks user interaction for you.
Pair it with :user-invalid for error styling after interaction.
Supported in modern Chromium, Firefox, and Safari.

Next: :user-invalid

Continue with :user-invalid.

:user-invalid →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

2 people found this page helpful