:-moz-ui-invalid

  • Revision slug: CSS/:-moz-ui-invalid
  • Revision title: :-moz-ui-invalid
  • Revision id: 53147
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment remove stuff that belongs on the talk page; 39 words removed

Revision Content

{{ CSSMozExtensionRef() }}{{ gecko_minversion_header("2.0") }}

Summary

The :-moz-ui-invalid CSS pseudo-class represents any validated form element whose value isn't valid based on their validation constraints, in certain circumstances. This pseudo-class is applied according to the following rules:

  • If the control does not have focus, and the value is invalid, apply this pseudo-class.
  • If the control has focus, and the value was valid (including empty) when it gained focus, do not apply the pseudo-class.
  • If the control has focus, and the value was invalid when it gained focus, re-validate on every keystroke.
  • If the element is required, the preceding rules apply only if the user has changed the value or attempted to submit the form.

The result is that if the control was valid when the user started interacting with it, the validity styling is changed only when the user shifts focus to another control. However, if the user is trying to correct a previously-flagged value, the control shows immediately when the value becomes valid. Required items have the pseudo-class applied only if the user changes them or attempts to submit an unchanged valid value.

By default, Gecko applies a style that creates a red "glow" (using the {{ Cssxref("box-shadow") }} property) around items with that have this pseudo-class applied. See the {{ Cssxref(":invalid") }} pseudo-class for an example that shows how to override the default style.

Browser compatibility

Browser Lowest version
Internet Explorer ---
Firefox (Gecko) 4.0 (2.0)
Opera ?
Safari (WebKit) ?

See also

  • {{ cssxref(":valid") }}
  • {{ cssxref(":invalid") }}
  • {{ cssxref(":required") }}
  • {{ cssxref(":optional") }}
  • {{ cssxref(":-moz-ui-valid") }}

Revision Source

<p>{{ CSSMozExtensionRef() }}{{ gecko_minversion_header("2.0") }}</p>
<h2 id="Summary">Summary</h2>
<p>The <code>:-moz-ui-invalid</code> CSS <a href="/en/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a> represents any <a href="/en/HTML/Forms_in_HTML#Constraint_Validation" title="https://developer.mozilla.org/en/HTML/HTML5/Forms_in_HTML5#Constraint_Validation">validated form element</a> whose value isn't valid based on their <a href="/en/HTML/Forms_in_HTML#Constraint_Validation" title="en/HTML/HTML5/Forms in HTML5#Constraint Validation">validation constraints</a>, in certain circumstances. This pseudo-class is applied according to the following rules:</p>
<ul> <li>If the control does not have focus, and the value is invalid, apply this pseudo-class.</li> <li>If the control has focus, and the value was valid (including empty) when it gained focus, do not apply the pseudo-class.</li> <li>If the control has focus, and the value was invalid when it gained focus, re-validate on every keystroke.</li> <li>If the element is required, the preceding rules apply only if the user has changed the value or attempted to submit the form.</li>
</ul>
<p>The result is that if the control was valid when the user started interacting with it, the validity styling is changed only when the user shifts focus to another control. However, if the user is trying to correct a previously-flagged value, the control shows immediately when the value becomes valid. Required items have the pseudo-class applied only if the user changes them or attempts to submit an unchanged valid value.</p>
<p>By default, Gecko applies a style that creates a red "glow" (using the {{ Cssxref("box-shadow") }} property) around items with that have this pseudo-class applied. See the {{ Cssxref(":invalid") }} pseudo-class for an example that shows how to override the default style.</p>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<table class="standard-table"> <tbody> <tr> <th>Browser</th> <th>Lowest version</th> </tr> <tr> <td>Internet Explorer</td> <td>---</td> </tr> <tr> <td>Firefox (Gecko)</td> <td>4.0 (2.0)</td> </tr> <tr> <td>Opera</td> <td>?</td> </tr> <tr> <td>Safari (WebKit)</td> <td>?</td> </tr> </tbody>
</table>
<h2 id="See_also">See also</h2>
<ul> <li>{{ cssxref(":valid") }}</li> <li>{{ cssxref(":invalid") }}</li> <li>{{ cssxref(":required") }}</li> <li>{{ cssxref(":optional") }}</li> <li>{{ cssxref(":-moz-ui-valid") }}</li>
</ul>
Revert to this revision