What does :hover used for

what does :hover used for??
waiting for answers
thank you…

:hover is used to style an element when the element is hovered. So like when a button is hovered, it changes color and so. It’s a Pseudo Class, so you have to use it with an actual element selector. Here’s an example:

btn {
  color: black;
 background-color: blue;


btn:hover {
  color: white;
  background-color: blue;

So the button has a black text, and when it’s hovered, it’s gonna change into a white text on blue background. Learn more about:

Pseudo Class: