<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
.box {
animation: change 3s forwards;
}
/* 百分比是相对动画时长 */
@keyframes change {
0% {
width: 100px;
height: 100px;
background-color: #ccc;
}
20% {
width: 200px;
height: 300px;
background-color: #aaa;
}
50% {
width: 200px;
height: 400px;
background-color: blue;
}
80% {
width: 600px;
height: 500px;
background-color: yellow;
}
100% {
width: 800px;
height: 800px;
background-color: red;
}
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
来源:https://www.cnblogs.com/divtab/p/11588660.html