User-Interaction :user-error

The :user-error pseudo-class represents an input element with incorrect input, but only after the user has interacted with it.

:user-error must match an :invalid, :out-of-range, or empty :required form element.

Browser Support

Chrome Firefox Safari Opera IE Edge
Desktop ? ? ? ? ? ?
Mobile ? ? ? ? ? ?

Syntax

E:user-error {
/* Style properties */
}

Example

/* In this example, any input element that is invalid, out of range, or required (but empty), AFTER the user has interacted with it, will have a red background. */

input:user-error {
background-color: red;
}

Information is based on Selectors Level 4 - W3C Working Draft (last updated on May 2, 2013)
Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C liability, trademark and document use rules apply.