:active (CSS selector)
Example
This rule will set the font color of
an active HTML link to #cccccc:
a:active {
color: #cccccc;
}
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.
Compatibility
| IE | 5.5 | Buggy |
|---|---|---|
| 6.0 | Buggy | |
| 7.0 | Buggy | |
| Firefox | 1.0 | Full |
| 1.5 | Full | |
| 2.0 | Full | |
| Safari | 1.3 | Full |
| 2.0 | Full | |
| 3.0 | Full | |
| Opera | 9.2 | Full |
| 9.5 | 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
:activeonly to HTMLaelements that have anhrefattribute. - Ignore
:activeunless 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.

