Skip to: content, navigation

by Tommy Olsson and Paul O’Brien

:active (CSS selector)

Browser support full matrix
IE5.5+ FF1+ Saf1.3+ Op9.2+
Buggy Full Full Full
Spec
Version
CSS1
:active {
declaration block
}

Example

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

a:active {
  color: #cccccc;
}

Try it yourself!View all demos

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

IE5.5Buggy
6.0Buggy
7.0Buggy
Firefox1.0Full
1.5Full
2.0Full
Safari1.3Full
2.0Full
3.0Full
Opera9.2Full
9.5Full

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

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters