Revision 296429 of :active

  • Revision slug: CSS/:active
  • Revision title: :active
  • Revision id: 296429
  • 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
{{ SpecName('CSS4 Selectors', '#active-pseudo', ':active') }} {{ Spec2('CSS4 Selectors') }} No change.
{{ SpecName('CSS3 Selectors', '#useraction-pseudos', ':active') }} {{ Spec2('CSS3 Selectors') }} No change.
{{ SpecName('CSS2.1', 'selector.html#dynamic-pseudo-classes', ':active') }} {{ Spec2('CSS2.1') }} No change.
{{ SpecName('CSS1', '#anchor-pseudo-classes', ':active') }} {{ Spec2('CSS1') }} Initial definition.

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&nbsp;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>{{ SpecName('CSS4 Selectors', '#active-pseudo', ':active') }}</td>
      <td>{{ Spec2('CSS4 Selectors') }}</td>
      <td>No change.</td>
    </tr>
    <tr>
      <td>{{ SpecName('CSS3 Selectors', '#useraction-pseudos', ':active') }}</td>
      <td>{{ Spec2('CSS3 Selectors') }}</td>
      <td>No change.</td>
    </tr>
    <tr>
      <td>{{ SpecName('CSS2.1', 'selector.html#dynamic-pseudo-classes', ':active') }}</td>
      <td>{{ Spec2('CSS2.1') }}</td>
      <td>No change.</td>
    </tr>
    <tr>
      <td>{{ SpecName('CSS1', '#anchor-pseudo-classes', ':active') }}</td>
      <td>{{ Spec2('CSS1') }}</td>
      <td>Initial definition.</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>&nbsp;</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>&nbsp;</td>
        <td>&nbsp;</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