:user-invalid (:-moz-ui-invalid)
Quick Summary for :user-invalid
The :user-invalid CSS pseudo-class represents any validated form element whose value isn't valid based on their validation constraints, after the user has interacted with it.
Code Usage for :user-invalid
<form>   <label for="email">Email *: </label>   <input id="email" name="email" type="email" required>   <span></span> </form> 
More Details for :user-invalid

:user-invalid (:-moz-ui-invalid)

The :user-invalid CSS pseudo-class represents any validated form element whose value isn't valid based on their validation constraints, after the user has interacted with it.

The :user-invalid pseudo-class must match an :invalid, :out-of-range, or blank-but :required element between the time the user has attempted to submit the form and before the user has interacted again with the form element.

Note: The pseudo-class behaves in the same way as the non-standard :-moz-ui-invalid pseudo-class.

Syntax

:user-invalid

Examples

Setting a color and symbol on :user-invalid

In the following example, the red border and ❌ only display once the user has interacted with the field. Try typing something other than an email address to see it in action.

<form>   <label for="email">Email *: </label>   <input id="email" name="email" type="email" required>   <span></span> </form> 
input:user-invalid {   border: 2px solid red; }  input:user-invalid + span::before {   content: '✖';   color: red; } 

Specifications

Specification
Selectors Level 4 # user-invalid-pseudo

See also

:valid :invalid :required :optional :user-valid

Last modified: Aug 12, 2021, by MDN contributors

Select your preferred language English (US)DeutschEspañolFrançais日本語 Change language

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Categories in CSS
css
Search CSS
Search CSS by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
The mind must be given relaxation; it will arise better and keener after resting. As rich fields must not be forced-for their productiveness, the have no rest, will quickly exhaust them constantlabor will break the vigor of the mind, but if it is released and relaxed a little while, it will recover its powers
Seneca
Random CSS Property

scrollbar-color

The scrollbar-color CSS property sets the color of the scrollbar track and thumb.
scrollbar-color css reference