css3动画之打字效果
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>速度曲线步长</title> <style> @keyframes w { 0% { width: 0; } 100% { width: 200px; } } div { overflow: hidden; font-size: 40px; width: 0; height: 40px; background-color: pink; animation-name: w; /* 5步走完 */ animation-timing-function: steps(5); animation-duration: 4s; /* 动画结束后的状态 forwards 填在原地*/ animation-fill-mode: forwards; } </style> </head> <body> <div>北京欢迎您</div> </body> </html>