Open In App

CSS :visited Selector

The :visited selector in CSS is used to select the visited links. For example, visit some link on the website and again see it, then it will find the changed color of that link. This change in color is done by :visited the selector. 
The allowed CSS property of : visited selectors are listed below: 

Syntax:  



:visited {
    // CSS Properties
}

Example: In this example, The :visited selector is used to style visited links, applying green color to the visited link in this example.




<!-- HTML code to illustrate :visited selectors -->
<!DOCTYPE html>
<html>
 
<head>
    <title>:visited selector</title>
    <style>
        /* visited CSS property */
        a:visited {
            color: green;
        }
    </style>
</head>
 
<body style="text-align:center">
    <h1>
        :visited Selector
    </h1>
    <h3>
        Click on the link
    </h3>
 
    <p>
        Visit Geeks:
        <a href="https://www.geeksforgeeks.org/"
           target="_blank">
            geeksforgeeks.org
        </a>
    </p>
 
</body>
 
</html>

Output: 



Supported Browser:

Article Tags :