
设置所有动画属性的简写属性是animation。它设置动画持续时间、动画名称等。
您可以尝试运行以下代码来使用动画简写属性:
示例
现场演示
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 150px;
height: 200px;
background-color: yellow;
animation: myanim 2s
}
@keyframes myanim {
from {
background-color: green;
}
to {
background-color: blue;
}
}
</style>
</head>
<body>
<div></div>
</body>
</html>










