To change the text color on hover in CSS, you can use the :hover pseudo-class selector in conjunction with the color property. Here’s an example:

a:hover {
  color: red;
}

This will change the text color of any <a> elements to red when the mouse pointer hovers over them.

You can also change the color of only a specific element by giving that element a class or ID and then targeting it specifically:

<p class="hover-color">Hover over me</p>
.hover-color:hover {
  color: blue;
}

In this example, only the text within the <p> tag with the class of “hover-color” will change to blue on hover.

Also Read:

Categorized in: