CSS active Selector (:active)

What is CSS :active Selector?

CSS :active selector matches all element whose href link currently active.

Syntax

General syntax of CSS :active selector,

:active {
  property: value;
  property: value;
  ...
}

a:active {
  property: value;
  property: value;
  ...
}

Example

Match all element whose href link currently active.

<!DOCTYPE html>
<html>
<head>
  <title>CSS :active Selector</title>
  <style type="text/css">
    a:active {
      color: red;
    }
  </style>
</head>
<body>
  <a href="#">First</a><br />
  <a href="#">Second</a><br />
  <a href="#">Third</a><br />
</body>
</html>

Run it...   »

Browser Compatibility

  • Google Chrome 1+
  • Mozilla Firefox 1+
  • Internet Explorer 7+
  • Opera 9.2+
  • Safari 1.3+

Note: Here details of browser compatibility with version number may be this is bug and not supported. But recommended to always use latest Web browser.