QP School

Full Version: Pseudo-classes in CSS3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Example:

<!DOCTYPE html>
<html>
<head>
  <title>Pseudo-classes Example</title>
  <style>
    /* Style the link when hovered */
    a:hover {
      color: red;
    }
  </style>
</head>
<body>
  <a href="#">Hover over this link</a>
</body>
</html>

Explanation:

Pseudo-classes target elements based on their state or user interaction. In this example, the a:hover pseudo-class selects the anchor (<a>) element when the user hovers over it and applies a red color to the text. When you hover over the link, the text turns red.