css 悬停时的动画(错误的方式)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 悬停时的动画(错误的方式)相关的知识,希望对你有一定的参考价值。

{"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 (wrong way)
 */

div {
	width: 9em;
	padding: .6em 1em;
	margin: 2em auto;
	background: yellowgreen;
}

@keyframes spin {
	to {
		transform: rotate(1turn);
	}
}

div:hover {
	animation: spin 1s linear infinite;
}

以上是关于css 悬停时的动画(错误的方式)的主要内容,如果未能解决你的问题,请参考以下文章