AI CSS Animations

Letters Rotate In Text Effect

Each letter swings up into place around its bottom-left corner like a hinged gate, tipping slightly past vertical before it settles. The overshoot comes from a cubic-bezier above 1.

Also known as: rotate in text animation, domino letters, letters stand up animation.

Stand tall

HTML

<div class="txt-letters-rotate-in" aria-label="Stand tall"><span style="--i: 0">S</span><span style="--i: 1">t</span><span style="--i: 2">a</span><span style="--i: 3">n</span><span style="--i: 4">d</span><span style="--i: 5">&nbsp;</span><span style="--i: 6">t</span><span style="--i: 7">a</span><span style="--i: 8">l</span><span style="--i: 9">l</span></div>

CSS

.txt-letters-rotate-in {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--c);
  white-space: nowrap;}
.txt-letters-rotate-in span {
  display: inline-block;
  transform-origin: 0 100%;
  animation: txt-letters-rotate-in-up 0.75s cubic-bezier(0.3, 1.45, 0.6, 1) calc(var(--i) * 65ms) both;
}
@keyframes txt-letters-rotate-in-up {
  0%   { opacity: 0; transform: rotate(80deg); }
  30%  { opacity: 1; }
  100% { opacity: 1; transform: rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
  .txt-letters-rotate-in, .txt-letters-rotate-in *, .txt-letters-rotate-in::before, .txt-letters-rotate-in::after, .txt-letters-rotate-in *::before, .txt-letters-rotate-in *::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