<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
div {
font-size: 20px;
width: 0px;
height: 30px;
background-color: pink;
/* 让我们的文字强制一行内显示 */
white-space: nowrap;
/* step 就是分几步来完成我们的动画 有了steps 就不要再写ease 或者linear */
animation: m 4s steps(10) forwards;
}
@keyframes m {
0% {
width: 0px;
}
100% {
width: 200px;
}
}
</style>
</head>
<body>
<div>风里雨里,我在这里等你</div>
</body>
</html>