CSS Selector :visited

Description

The :visited selector selects visited links.

Example


<!DOCTYPE HTML> 
<html> 
    <head> 
        <title>Example</title> 
        <style type="text/css"> 
        :link { <!--  w ww.ja va  2  s.co m-->
            border: thin black solid; 
            background-color: lightgrey; 
            padding: 4px; 
            color:red; 
        } 
        :visited { 
            background-color: grey; 
            color:white; 
        } 
        </style> 
    </head> 
    <body> 
        <a href="http://java2s.com">Visit the java2s.com</a> 
        <a href="http://w3c.org">Visit the W3C website</a> 
    </body> 
</html>

Click to view the demo

Only some properties can be applied to links using the :visited selector. You can change the colors and the font.

The code above generates the following result.

:visited




















Home »
  HTML CSS »
    HTML CSS Reference »




HTML Tag Reference
CSS Reference
CSS Selector Reference
Encoding Reference