CSS/Selectors/pseudo-classes/:active

From W3C Wiki
< CSS‎ | Selectors
Jump to: navigation, search

Pseudo-classes :active

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

Syntax

a:hover{ 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>

Css3 selectors dyn active.png

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