CSS3/Selectors/pseudo-classes/:active

From W3C Wiki

Pseudo-classes :active

The :active pseudo-class applies while an element is being activated by the user.

Syntax

selector:active{ properties }


Point, Note

  • For example, between the times the user presses the mouse button and releases it.
  • On systems with more than one mouse button, :active applies only to the primary or primary activation button (typically the "left" mouse button), and any aliases thereof.


Example

[style.css]

 a:link, a:visited{
   color: red;
 }
 a:hover{
   color: green;
 }
 a:active{
   color: blue;
 }


[index.html]

<body>
  <p><a href="http://www.w3.org/">W3C</a> is an international community</p>
</body>

The CSS Selectors Level 3 specification defines the :active pseudo-class in 6.6.1.2. The user action pseudo-classes :hover, :active, and :focus.