I am facing an issue with a button that I want to rotate upon mouse hover. The problem is, the rotation works perfectly when the mouse enters, but it continues spinning even after the mouse leaves. Here's the code snippet for better understanding:
button {
transition: transform 1.2s linear;
}
button:hover {
transform: rotate(360deg);
}
<button>X</button>
Is there a way to make the button spin only when the mouse enters, and not when it leaves?