Set the background color for visited and unvisited links to "pink", and the background color for the hover and active link states to "yellow". - HTML CSS CSS

HTML CSS examples for CSS:Quiz

Description

Set the background color for visited and unvisited links to "pink", and the background color for the hover and active link states to "yellow".

Demo Code

ResultView the demo in separate window

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

/* visited link */
a:visited {<!--  ww w  .j  a  v a 2  s .c  o m-->
    background-color: pink;
}

/* mouse over link */
a:hover {
    background-color: yellow;
}

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

<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
<p><a href="http://java2s.com">java2s.com</a></p>

</body>
</html>

Related Tutorials