StealThis .dev

Flip Text

Words that flip and rotate vertically to cycle through different words with smooth CSS perspective transitions.

Open in Lab
css javascript vue svelte
Targets: TS JS HTML React Vue Svelte

Code

Flip Text

Cycles through an array of words with a vertical flip animation. Each word rotates in from below, holds, then flips out upward to reveal the next word.

How it works

  1. A container with overflow: hidden and perspective clips the text during rotation
  2. @keyframes flip rotates each word along the X-axis from 90deg (hidden) through 0deg (visible) and back to -90deg (exit)
  3. JavaScript cycles through the word list, updating the displayed word on each animation iteration
  4. transform-origin: center bottom ensures the flip feels natural

Customization

  • Pass any array of words via the data-words attribute (HTML) or words prop (React)
  • --flip-duration controls total time per word (default: 2.5s)
  • Works inline with static text: “We build [amazing|beautiful|fast] products”

When to use it

  • Hero taglines with rotating keywords
  • Feature descriptions cycling through benefits
  • Any text that needs to communicate multiple concepts in one space