CSS - A: Active


CSS - A: Active

  • In CSS, a: active defines the style of an element on which the user is currently clicking.

Sample Code :

<! DOCTYPE html>
<html>
    <head>
        <style>
            a: active
                {
                color: green;
                }
        </style>
    </head>
    <body>
        <p>
            <b>
                <a href="http://www.wikitechy.com/"target="_blank">
                   Best E-Learning Website In the World</a>
            </b>
        </p>
    </body>
</html>


Code Explanation :


    Here a: active is the link that defines the style of an element on which the user is currently clicking.

    Specifying color green for a: visited property means the link color will change from blue to green when user click it.

    href is the attribute which specifies the destination address.   target="_blank" Open the Link in new tab.

Output :


    Normally all the text we type in <a></a> tag appears in blue color and underlined which we have displayed in the browser window


    When we click the link, the text link “Best E-learning Website in the world” changes from blue to green indicating that we have clicked the link, which we have displayed in the browser window.

  • Clicking on the link “Best E-learning Website in the world” will direct us to the wikitechy website which is displayed below.