When we apply a hover effect on an element (like a div to have a box-shadow when hovered over) with transition of 1s. It gets an animation when hovered but as soon as u move the mouse away, it has no transition, it just drastically returns to the state.
How do you give a transition of like 1s for when we leave the hover state?
I saw a few codes but couldn't see what was making it happen.
div {
width: 50px;
height: 50px;
background: purple;
}
div:hover {
animation: nav 1s linear forwards;
}
@keyframes nav {
to {
box-shadow: 5px 5px 2px black;
}
}
<div></div>