mozilla

Revision 289939 of :active

  • Revision slug: CSS/:active
  • Revision title: :active
  • Revision id: 289939
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{ CSSRef() }}

Summary

The :active CSS 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
Support on the <a> element 1.0 {{ CompatGeckoDesktop("1.0") }} 4.0 5.0 1.0
Support on any element 1.0 {{ CompatGeckoDesktop("1.0") }} 8.0 7.0  
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Support on the <a> element 1.0 {{ CompatGeckoMobile("1.0") }} 6.0 6.0 1.0
Support on any element 1.0 {{ CompatGeckoMobile("1.0") }} {{ CompatUnknown() }}    


See also

  • Link-related pseudo-classes: {{ cssxref(":link") }}, {{ cssxref(":visited") }}, {{ cssxref(":hover") }} and {{ cssxref(":active") }}

Revision Source

<p>{{ CSSRef() }}</p>
<h2 id="Summary">Summary</h2>
<p>The <code>:active</code> CSS <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">
  <thead>
    <tr>
      <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>Support on the <code>&lt;a&gt;</code> element</td>
        <td>1.0</td>
        <td>{{ CompatGeckoDesktop("1.0") }}</td>
        <td>4.0</td>
        <td>5.0</td>
        <td>1.0</td>
      </tr>
      <tr>
        <td>Support on any element</td>
        <td>1.0</td>
        <td>{{ CompatGeckoDesktop("1.0") }}</td>
        <td>8.0</td>
        <td>7.0</td>
        <td> </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>Support on the <code>&lt;a&gt;</code> element</td>
        <td>1.0</td>
        <td>{{ CompatGeckoMobile("1.0") }}</td>
        <td>6.0</td>
        <td>6.0</td>
        <td>1.0</td>
      </tr>
      <tr>
        <td>Support on any element</td>
        <td>1.0</td>
        <td>{{ CompatGeckoMobile("1.0") }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td> </td>
        <td> </td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="
__See_also"><br>
  See also</h2>
<ul>
  <li>Link-related pseudo-classes: {{ cssxref(":link") }}, {{ cssxref(":visited") }}, {{ cssxref(":hover") }} and {{ cssxref(":active") }}</li>
</ul>
Revert to this revision