AI CSS Animations

Crossed Two Row Marquee

Two tilted ribbons cross in an X and scroll in opposite directions, the loud look of agency and streetwear sites. Same keyframe for both rows; the second simply runs it in reverse.

Also known as: two row marquee opposite directions, crossing marquee ribbons, diagonal scrolling text.

New drop ✦ Free shipping ✦ New drop ✦ Free shipping ✦ 
Limited stock ✦ Shop now ✦ Limited stock ✦ Shop now ✦ 

HTML

<div class="txt-two-row-marquee">
  <div class="txt-two-row-marquee-row">
    <div class="txt-two-row-marquee-group">New drop ✦ Free shipping ✦ New drop ✦ Free shipping ✦&nbsp;</div>
    <div class="txt-two-row-marquee-group" aria-hidden="true">New drop ✦ Free shipping ✦ New drop ✦ Free shipping ✦&nbsp;</div>
  </div>
  <div class="txt-two-row-marquee-row">
    <div class="txt-two-row-marquee-group">Limited stock ✦ Shop now ✦ Limited stock ✦ Shop now ✦&nbsp;</div>
    <div class="txt-two-row-marquee-group" aria-hidden="true">Limited stock ✦ Shop now ✦ Limited stock ✦ Shop now ✦&nbsp;</div>
  </div>
</div>

CSS

.txt-two-row-marquee {
  --c: var(--txt-color, #3b82f6);
  font-size: calc(var(--txt-size, 32px) * 0.75);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  display: grid;
  place-items: center;
  width: 19em;
  height: 5em;
  white-space: nowrap;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);}
.txt-two-row-marquee-row {
  grid-area: 1 / 1;
  display: flex;
  width: 110%;
  padding: 0.35em 0;
  overflow: hidden;
  color: #fff;
  background: var(--c);
  transform: rotate(-4deg);
  box-shadow: 0 0.2em 0.5em -0.2em rgb(0 0 0 / 0.35);
}
.txt-two-row-marquee-row:first-child {
  z-index: 1;
}
.txt-two-row-marquee-row:last-child {
  background: color-mix(in srgb, var(--c) 30%, #111827);
  transform: rotate(4deg);
}
.txt-two-row-marquee-group {
  flex-shrink: 0;
  animation: txt-two-row-marquee-scroll 12s linear infinite;
}
.txt-two-row-marquee-row:last-child .txt-two-row-marquee-group {
  animation-direction: reverse;
}
@keyframes txt-two-row-marquee-scroll {
  to { transform: translateX(-100%); }
}

@media (prefers-reduced-motion: reduce) {
  .txt-two-row-marquee, .txt-two-row-marquee *, .txt-two-row-marquee::before, .txt-two-row-marquee::after, .txt-two-row-marquee *::before, .txt-two-row-marquee *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --txt-color on the element or a parent. Currently previewing #3b82f6.
  • Font size: set --txt-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 40px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar text animations