, , , , .
, CSS,
.icon {
transition: transform 0.5s;
}
.icon:hover {
transform: rotate(90deg);
}
:hover psuedo
.icon:hover {
transition: transform 0.5s;
transform: rotate(90deg);
}
, !
This works because I initially set the transition to 0.5 s by default. In this case, it means both forward and backward. By placing the property transitioninside the hover, I have a 0.5 s transition when the hover is activated, and a 0 s transition (default) when the icon is not displayed. When hovering at 0 s, it means that it simply instantly returns to its original position, invisibly to the viewer.
source
share