CSS :active pseudo-class
CSS :active Pseudo-Class
Description
The :active pseudo-class is used to add special effects to activated elements.
When defining pseudo-classes within a <style>...</style>
block, keep the following in mind:
- a:hover must appear after a:link and a:visited in the CSS definition to take effect.
-
a:active must be within CSS definition before a:hover takes effect.
-
Pseudo-class names are case-insensitive.
-
Pseudo-classes are distinct from CSS classes, but can be combined.
Possible Values
- color – Any valid color value.
Applicable Objects
Anchor/Link elements.
Example
The following example demonstrates how to use the :active class to change the color of an activated link.
<html>
<head>
<style type="text/css">
a:active {color: #FF00CC}
</style>
</head>
<body>
html/index.htm">Click this link
</body>
</html>
This will generate the following link. When the user clicks it, it will turn pink.