Animation on hover (right way)
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}// alert('Hello world!');<div ontouchstart="">Hover over me and watch me spin!</div>/**
* Animation on hover (right way)
*/
div {
width: 9em;
padding: .6em 1em;
margin: 2em auto;
background: yellowgreen;
animation: spin 1s linear infinite;
animation-play-state: paused;
}
@keyframes spin {
to {
transform: rotate(1turn);
}
}
div:hover {
animation-play-state: running;
}