打字效果
sonder 中杯

代码来源: https://lhammer.cn/You-need-to-know-css/#/zh-cn/typing

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

<style>
main {
width: 100%; height: 229px;
display: flex;
justify-content: center;
align-items: center;
}
span {
display: inline-block;
width: 11ch;
font: bold 200% Consolas, Monaco, monospace; /*等宽字体*/
overflow: hidden;
white-space: nowrap;
font-weight: 500;
border-right: 1px solid transparent;
animation: typing 1.7s steps(6), caret .5s steps(1) infinite;
}
@keyframes typing{
from {
width: 0;
}
}
@keyframes caret{
50% { border-right-color: currentColor}
}
</style>
<template>
<main class="main">
<span>先富带动后富</span>
</main>
</template>
<script>
</script>
  • 本文标题:打字效果
  • 本文作者:sonder
  • 创建时间:2023-02-16 16:13:08
  • 本文链接:https://sonderss.github.io/2023/02/16/打字效果/
 评论