css/html 打字機效果輸出文字
阿新 • • 發佈:2018-12-29
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
@keyframes typing { from { width: 0; } }
@keyframes blink-caret { 50% { border-color: transparent; } }
h1 {
font: bold 200% Consolas, Monaco, monospace;
border-right: .1em solid;
width: 16.5em; /* fallback */
/* width: 30ch; # of chars */
margin: 2em 1em;
white-space: nowrap;
overflow: hidden;
blink-caret .5s step-end infinite alternate;
}
</style>
</head>
<body>
<h1> 一個小小前端工程師的部落格一步一步, 一個字一個字的打出來,哦蕾蕾~</h1>
</body>
</html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
@keyframes typing { from { width: 0; } }
@keyframes blink-caret { 50% { border-color: transparent; } }
h1 {
font: bold 200% Consolas, Monaco, monospace;
border-right: .1em solid;
width: 16.5em; /* fallback */
/* width: 30ch; # of chars */
margin: 2em 1em;
white-space: nowrap;
overflow: hidden;
animation: typing 20s steps(16, end), /* # of steps = # of chars */ /*animation: typing 20s steps(30, end),*//*英文速度*/
}
</style>
</head>
<body>
<h1> 一個小小前端工程師的部落格一步一步, 一個字一個字的打出來,哦蕾蕾~</h1>
</body>
</html>