CSS :user-valid Pseudo-class

Definition and Usage

CSS :user-valid The pseudo-class is used to set the style of valid form elements after the user interacts with them.

Tip:Usage :user-invalid Set the style of the pseudo-class for invalid form elements (after user interaction).

Example

Set the style of the <input> element after the user interacts with it:

input:user-valid {
  border: 2px solid green;
  background-color: beige;
}

Try It Yourself

CSS Syntax

:user-valid {
  css declarations;
}

Technical Details

Version: CSS4

Browser Support

The numbers in the table specify the first browser version to fully support this pseudo-class.

Chrome Edge Firefox Safari Opera
119 119 88 16.5 105

Pagine correlate

Riferimento:Pseudo-classe CSS :user-invalid