:link - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:link

Description

The :link selector selects unvisited links.

Use the :visited selector to style links to visited pages.

Use the :hover selector to style links when you mouse is over them.

Use the :active selector to style links when you click on them.

Example

Select and style unvisited, visited, hover, and active links:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
/* unvisited link */
a:link {
    color: green;
}

/* visited link */
a:visited {<!--   w ww .  java 2  s.  c om-->
    color: green;
}

/* mouse over link */
a:hover {
    color: red;
}

/* selected link */
a:active {
    color: yellow;
}
</style>
</head>
<body>

<p>Mouse over and click the link: <a href="https://www.java2s.com">java2s.com</a></p>

</body>
</html>

Related Tutorials