How to change the color of active links with CSS


Use the :active class to change the color of active links. Possible values could be any color name in any valid format. 

Example

You can try to run the following code to implement the color of an active link −

<html>
   <head>
      <style>
         a:active {
            color: #FF00CC
         }
      </style>
   </head>
   <body>
      <a href = "">My Link</a>
   </body>
</html>

Updated on: 05-Mar-2020

4K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements