:default

  • Revision slug: CSS/:default
  • Revision title: :default
  • Revision id: 41470
  • Created:
  • Creator: brianloveswords
  • Is current revision? No
  • Comment one or more formatting changes

Revision Content

{{ CSSRef() }} {{ Fx_minversion_header("3") }}

Summary

The :default pseudo-class represents any user interface element that is the default among a group of similar elements.

For example, the default button in a set of buttons could be selected using this pseudo-class.

User interface elements that permit multiple selections may have multiple defaults set in order to initially appear with multiple items selected. In that case all defaults can be represented using the :default pseudo-class.

Syntax

:default { style properties }

Examples

:default
{
    background-color: lime;
}

...where...

 <form method="get">
  <p><input type="submit" id="submit1"></p>
  <p><input type="submit" id="submit2"></p>
  <p><input type="reset"></p>
 </form>

This example causes the background color to be lime for the default submit button in the form.

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

Specification

{{ languages( { "es": "es/CSS/:default", "ja": "ja/CSS/:default", "fr": "fr/CSS/:default" } ) }}

Revision Source

<p>{{ CSSRef() }} {{ Fx_minversion_header("3") }}</p>
<h2 name="Summary">Summary</h2>
<p>The <code>:default</code> <a href="/en/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a> represents any user interface element that is the default among a group of similar elements.</p>
<p>For example, the default button in a set of buttons could be selected using this pseudo-class.</p>
<p>User interface elements that permit multiple selections may have multiple defaults set in order to initially appear with multiple items selected. In that case all defaults can be represented using the <code>:default</code> pseudo-class.</p>
<h2 name="Syntax">Syntax</h2>
<pre class="eval">:default { <em>style properties</em> }
</pre>
<h2 name="Examples">Examples</h2>
<pre class="brush: css">:default
{
    background-color: lime;
}
</pre>
<p>...where...</p>
<pre class="brush: html"> &lt;form method="get"&gt;
  &lt;p&gt;&lt;input type="submit" id="submit1"&gt;&lt;/p&gt;
  &lt;p&gt;&lt;input type="submit" id="submit2"&gt;&lt;/p&gt;
  &lt;p&gt;&lt;input type="reset"&gt;&lt;/p&gt;
 &lt;/form&gt;
</pre>
<p>This example causes the background color to be <code>lime</code> for the default submit button in the form.</p>
<h2>Browser compatibility</h2>
<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>
<h2 name="Specification">Specification</h2>
<ul> <li><a class="external" href="http://www.w3.org/TR/css3-ui/#pseudo-default">CSS3 Basic User Interface Module: :default</a></li> <li><a class="external" href="http://www.whatwg.org/specs/web-forms/current-work/#enter-submit">Web Forms 2.0: Relation to CSS selectors</a></li>
</ul>
<p>{{ languages( { "es": "es/CSS/:default", "ja": "ja/CSS/:default", "fr": "fr/CSS/:default" } ) }}</p>
Revert to this revision