mozilla

Revision 42235 of :active

  • Revision slug: CSS/:active
  • Revision title: :active
  • Revision id: 42235
  • Created:
  • Creator: brianloveswords
  • Is current revision? No
  • Comment 1 words added

Revision Content

{{ CSSRef() }}

Summary

The :active pseudo-class matches when an element is being activated by the user. It allows the page to give a feedback that the activation has been detected by the browser. When interacting with a mouse, this is typically the time between the user presses the mouse button and releases it. It is often used on {{ HTMLElement("a") }} and {{ HTMLElement("button") }} HTML elements.

This style may be overridden by any other link-related pseudo-classes, that is {{ cssxref(":link") }}, {{ cssxref(":hover") }}, and {{ cssxref(":visited") }}, appearing in subsequent rules. In order to style appropriately links, you need to put the :active rule after the all others link-related rules, as defined by the LVHA-order: :link:visited:hover:active.

Note: on system with mice having several buttons, CSS 3 specifies that the :active pseudo-class must only apply to the primary button, typically the left-most button on mice for right-handed.

Specifications

Specification Status Comment
CSS 3 Selectors {{ Spec2('CSS3 Selectors') }}  
CSS 2.1 Selectors {{ Spec2('CSS2.1') }}  
CSS 1 Anchor pseudo-class {{ Spec2('CSS2.1') }}  

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1.0 {{ CompatGeckoDesktop("1") }}
  • 4.0 (only for <a>)
  • 8.0 (on all elements)
  • 5.0 (only for <a>)
  • 7.0
1.0
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 1.0 {{ CompatGeckoMobile("1") }} 6.0 (only for <a>) 6.0 1.0

{{ languages( { "fr": "fr/CSS/%3Aactive" } ) }}

Revision Source

<p>{{ CSSRef() }}</p>
<h2 id="Summary">Summary</h2>
<p>The <code>:active</code> <a href="/en/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a> matches when an element is being activated by the user. It allows the page to give a feedback that the activation has been detected by the browser. When interacting with a mouse, this is typically the time between the user presses the mouse button and releases it. It is often used on {{ HTMLElement("a") }} and {{ HTMLElement("button") }} HTML elements.</p>
<p>This style may be overridden by any other link-related pseudo-classes, that is {{ cssxref(":link") }}, {{ cssxref(":hover") }}, and {{ cssxref(":visited") }}, appearing in subsequent rules. In order to style appropriately links, you need to put the <code>:active</code> rule after the all others link-related rules, as defined by the <em>LVHA-order</em>: <code>:link</code> — <code>:visited</code> — <code>:hover</code> — <code>:active</code>.</p>
<div class="note"><strong>Note:</strong> on system with mice having several buttons, CSS 3 specifies that the <code>:active</code> pseudo-class must only apply to the primary button, typically the left-most button on mice for right-handed.</div>
<h2 class="editable" id="Specifications"><span>Specifications</span></h2>
<table class="standard-table" style="width: 404px; height: 84px;"> <thead> <tr style="background-color: rgb(255, 204, 255);"> <th scope="col">Specification</th> <th scope="col">Status</th> <th scope="col">Comment</th> </tr> </thead> <tbody> <tr> <td><a class="external" href="http://www.w3.org/TR/css3-selectors/#useraction-pseudos" rel="external nofollow" target="_blank" title="http://www.w3.org/TR/css3-selectors/#useraction-pseudos">CSS 3 Selectors</a></td> <td>{{ Spec2('CSS3 Selectors') }}</td> <td> </td> </tr> <tr> <td><a class="external" href="http://www.w3.org/TR/CSS21/selector.html#dynamic-pseudo-classes" rel="external nofollow" target="_blank" title="http://www.w3.org/TR/CSS21/selector.html#dynamic-pseudo-classes">CSS 2.1 Selectors</a></td> <td>{{ Spec2('CSS2.1') }}</td> <td> </td> </tr> <tr> <td><a class="external" href="http://www.w3.org/TR/CSS1/#anchor-pseudo-classes" rel="external nofollow" target="_blank" title="http://www.w3.org/TR/CSS1/#anchor-pseudo-classes">CSS 1 Anchor pseudo-class</a></td> <td>{{ Spec2('CSS2.1') }}</td> <td> </td> </tr> </tbody>
</table>
<h2 id="Browser_compatibility">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>1.0</td> <td>{{ CompatGeckoDesktop("1") }}</td> <td> <ul> <li>4.0 (only for <code>&lt;a&gt;</code>)</li> <li>8.0 (on all elements)</li> </ul> </td> <td> <ul> <li>5.0 (only for <code>&lt;a&gt;</code>)</li> <li>7.0</li> </ul> </td> <td>1.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>1.0</td> <td>{{ CompatGeckoMobile("1") }}</td> <td>6.0 (only for &lt;a&gt;)</td> <td>6.0</td> <td>1.0</td> </tr> </tbody> </table>
</div>
<p>{{ languages( { "fr": "fr/CSS/%3Aactive" } ) }}</p>
Revert to this revision