:required

  • Revision slug: CSS/:required
  • Revision title: :required
  • Revision id: 233608
  • Created:
  • Creator: FredB
  • Is current revision? No
  • Comment 19 words added

Revision Content

{{ CSSRef() }}

Summary

The :required CSS pseudo-class represents any {{ HTMLElement("input") }} element that has the {{ htmlattrxref("required", "input") }} attribute set on it. This allows forms to easily indicate which fields must have valid data before the form can be submitted.

The {{ cssxref(":optional") }} pseudo-class may be used to provide an appearance for optional form fields.

Examples

See {{ cssxref(":invalid") }} for an example.

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 10.0 {{ CompatGeckoDesktop("2") }} {{ CompatNo() }} 10.0 5.0
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{ CompatGeckoMobile("2") }} {{ CompatNo() }} 10.0 5.0

Specifications

See also

  • {{ cssxref(":optional") }}
  • {{ cssxref(":invalid") }}
  • {{ cssxref(":valid") }}

{{ languages( { "fr": "fr/CSS/:required" } ) }}

Revision Source

<p>{{ CSSRef() }}</p>
<h3>Summary</h3>
<p>The <code>:required</code> CSS <a href="/en/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a> represents any {{ HTMLElement("input") }} element that has the {{ htmlattrxref("required", "input") }} attribute set on it. This allows forms to easily indicate which fields must have valid data before the form can be submitted.</p>
<p>The {{ cssxref(":optional") }} pseudo-class may be used to provide an appearance for optional form fields.</p>
<h3>Examples</h3>
<p>See {{ cssxref(":invalid") }} for an example.</p>
<h3>Browser compatibility</h3>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari</th> </tr> <tr> <td>Basic support</td> <td>10.0</td> <td>{{ CompatGeckoDesktop("2") }}</td> <td>{{ CompatNo() }}</td> <td>10.0</td> <td>5.0</td> </tr> </tbody> </table>
</div>
<div id="compat-mobile"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Mobile</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatGeckoMobile("2") }}</td> <td>{{ CompatNo() }}</td> <td>10.0</td> <td>5.0</td> </tr> </tbody> </table>
</div>
<h3>Specifications</h3>
<ul> <li><a class="external" href="http://www.w3.org/TR/css3-ui/#pseudo-required-value" title="http://www.w3.org/TR/css3-ui/#pseudo-required-value">CSS 3 Basic User Interface Module</a></li>
</ul>
<h3>See also</h3>
<ul> <li>{{ cssxref(":optional") }}</li> <li>{{ cssxref(":invalid") }}</li> <li>{{ cssxref(":valid") }}</li>
</ul>
<p>{{ languages( { "fr": "fr/CSS/:required" } ) }}</p>
Revert to this revision