Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

CSS | :visited Selector

  • Last Updated : 04 Aug, 2021

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

  • color
  • border-color
  • background-color
  • outline color
  • column-rule-color
  • fill-color and stroke

Syntax: 
 

:visited {
    // CSS Properties
}

Example: 
 

html




<!-- 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:

  • Google Chrome
  • Microsoft Edge
  • Firefox
  • Opera
  • Safari
     
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!