Skip to: content, navigation

:active (CSS selector)

Spec
Version
CSS1
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+
Buggy Full Full Full

Syntax

:active {
declaration block
}

Description

This pseudo-class matches any element that’s in the process of being activated. It would apply, for instance, for the duration of a mouse-click on a link, from the point at which the mouse button’s pressed down until the point at which it’s released again. The pseudo-class does not signify a link to the active, or current, page—that’s a common misconception among CSS beginners.

Example

This rule will set the font color of an active HTML link to #cccccc:

a:active {
  color: #cccccc;
}

Compatibility

Internet Explorer Firefox Safari Opera
5.5 6.0 7.0 1.0 1.5 2.0 1.3 2.0 3.0 9.2 9.5
Buggy Buggy Buggy Full Full Full Full Full Full Full Full

Internet Explorer 5.5 and 6 incorrectly apply this pseudo-class to links that have keyboard input focus—a state that should be matched by :focus, which those browsers do not support.

Internet Explorer versions up to and including 7:

  • Apply :active only to HTML a elements that have an href attribute.
  • Ignore :active unless it’s the last part of a pseudo-class chain.

User-contributed notes

There are no comments yet.

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

Search