<h2 data-text="&nbsp;♠ 好玩又有趣的CSS动画效果 ♣ &nbsp;">&nbsp;♠ 好玩又有趣的CSS动画效果♣ &nbsp;</h2>

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #111;
}

h2 {
  position: relative;
  font-size: 8em;
  color: #222;
}

h2::before {
  content: attr(data-text);
  position: absolute;
  white-space: nowrap;
  color: #fff;
  overflow: hidden;
  border-right: 4px solid #fff;
  animation: animate 8s linear infinite;
  filter: drop-shadow(0 0 20px #fff)  drop-shadow(0 0 50px #fff);
}

@keyframes animate {
  0%,10%,100% {
    width: 0;
  }
  
  70%,90% {
    width: 100%;
  }
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.