Table of Contents

CSS Pseudo-class selectors

  • Pseudo-class selectors select elements based on a certain state like .
  • Style an element when a user mouses over it.
  •  Style visited and unvisited links differently.
  • Style an element when it gets focus .
  • Links can be displayed in different ways.
Example
<!DOCTYPE html>
<html>
<head>
<style>
/* unvisited link */
a:link {
color: red;
}

/* visited link */
a:visited {
color: green;
}

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

/* selected link */
a:active {
color: blue;
}
</style>
</head>
<body>
<h2>Example of CSS Pseudo-class selectors</h2>
<p><b><a href="https://nielitbhu.com/" target="_blank">This is a link</a></b></p>

</body>
</html>
English Hindi