Typography · 23 of 33

Infinite Marquee

Continuous scrolling text loop

HTML · CSS · No dependencies · MIT

HTML

<div class="marquee-wrapper">
  <div class="marquee-inner">
    <span>SCROLLING TEXT LOOP &bull; SCROLLING TEXT LOOP &bull; </span><span aria-hidden="true">SCROLLING TEXT LOOP &bull; SCROLLING TEXT LOOP &bull; </span>
  </div>
</div>

CSS

.marquee-wrapper {
  overflow: hidden;
  white-space: nowrap;
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.marquee-inner {
  display: inline-block;
  animation: marquee 10s linear infinite;
}

.marquee-inner span {
  padding-right: 2rem;
  font-size: 3rem;
  font-weight: 700;
  color: #6b6b80;
}

/* The text is duplicated in the HTML, so -50% loops seamlessly */
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}