<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CodePen Home Page Typography Animation</title>
<style>
  .typewrite {
    font-size: 40px;
    color: #fff;
    text-align: center;
    font-family: 'Courier New', Courier, monospace;
    white-space: nowrap;
    overflow: hidden;
    border-right: .15em solid orange;
    letter-spacing: .15em;
    animation: typing 3.5s steps(20, end), blink-caret .75s step-end infinite;
  }
  @keyframes typing {
    from { width: 0; }
    to { width: 100%; }
  }
  @keyframes blink-caret {
    from, to { opacity: 0; }
    50% { opacity: 1; }
  }
</style>
</head>
<body>
<div class="typewrite">
  Welcome to CodePen!
</div>
</body>
</html>这段代码使用了CSS的@keyframes规则来创建打字机动画,通过改变元素的宽度从0到100%来模拟文本的输出,同时提供了一个闪烁的光标动画,提升了用户体验。这个例子简洁易懂,适合作为初学者理解和实践CSS动画的教学材料。