<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box{
width: 0;
height: 30px;
font-family: monospace;
white-space: nowrap;
overflow: hidden;
animation: move 10s steps(11) forwards;
}
/* 2ch 一个字体的宽度 */
@keyframes move {
0%{
width: 0ch;
}
100%{
width: 22ch;
}
}
</style>
</head>
<body>
<div class="box">
看山不是山 看水不是水
</div>
</body>
</html>
使用动画实现打字机效果?(animation)
于 2023-08-30 16:10:26 首次发布