: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


Bajo
Random CSS Property

pad

The pad descriptor can be used with custom counter style definitions when you need the marker representations to have a minimum length.
pad (@counter-style) css reference