:visited

In this chapter you will learn:

  1. Definition for Selector:visited
  2. An example showing how to use :visited CSS selector

Description

The :visited selector selects visited links.

Example

<!DOCTYPE HTML> <!--from ja va  2  s .  co m-->
<html> 
    <head> 
        <title>Example</title> 
        <style type="text/css"> 
        :link { 
            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.

Next chapter...

What you will learn in the next chapter:

  1. Definition for Selector :active
  2. An example showing how to use :active CSS selector
Home » HTML CSS Tutorial » CSS Selector Reference
.class
#id
*
element
element,element
element element
element>element
element+element
element1~element2
:lang
:link
:visited
:active
:hover
:focus
:first-letter
:first-line
:first-child
:last-child
:only-child
:nth-child(n)
:nth-last-child(n)
:before
:after
:first-of-type
:last-of-type
:only-of-type
:nth-of-type(n)
:nth-last-of-type(n)
:root
:empty
:target
:enabled
:disabled
:checked
:not
::selection
[attribute]
[attribute=value]
[attribute~=value]
[attribute|=value]
[attribute^=value]
[attribute$=value]
[attribute*=value]