<p>a continuous background coloration</p>
<span class="type" style="--n:22;">I am a multi-line text</span>
<p>We clip it to the text</p>
<span class="type clip" style="--n:22;">I am a multi-line text</span>
<p>We make it a discrete animation </p>
<span class="type clip step" style="--n:22;">I am a multi-line text</span>
body {
  background:#005F6B;
  color:#fff;
  max-width:300px;
}
p {
  margin:5px 0;
}
.type {
  outline:2px solid red;
  font-family: monospace;
  font-weight: 700;
  font-size:35px;
  background:linear-gradient(#00DFFC 0 0) 0 0;
  background-size:calc(var(--n)*1ch) 200%;
  background-repeat:no-repeat;
  animation: t calc(var(--n)*.3s) linear infinite alternate;
}
@keyframes t{
  from {background-size:0 200%}
}
.clip {
  color:#0000;
  -webkit-background-clip:text;
  background-clip:text;
}
.step {
  animation-timing-function:steps(var(--n))
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.