The :active CSS pseudo-class matches when an element is being activated by the user. It allows the page to give a feedback that the activation has been detected by the browser. When interacting with a mouse, this is typically the time between the user presses the mouse button and releases it. The :active pseudo-class is also typically matched when using the keyboard tab key. It is frequently used on <a> and <button> HTML elements, but may not be limited to just those.
This style may be overridden by any other link-related pseudo-classes, that is :link, :hover, and :visited, appearing in subsequent rules. In order to style appropriately links, you need to put the :active rule after the all others link-related rules, as defined by the LVHA-order: :link — :visited — :hover — :active.
<!DOCTYPE html> <html> <head> <style> a:active { color: #0F3 } /* active links */ </style> </head> <body> <body> <p> Click this link to see active effect <a href="#">will change on click</a> </p> </body> </body> </html>