您的位置:首页 > Web前端 > CSS

纯CSS3属性animation实现的打字效果

2016-02-29 15:12 387 查看
*{margin:0;padding:0;}
@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: 34ch; /* # of chars */
margin: 2em 1em;
white-space: nowrap;
overflow: hidden;
animation: typing 20s steps(30, end),
blink-caret .5s step-end infinite alternate;
}
html页面
<h1>Typing animation by lanrenzhijia.com</h1>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: