Live preview · fully interactive
The prompt
Build a headline with a sliding clipped gradient. ## Look Headline clamp(36px, 7vw, 84px), tracking -0.05em, line-height 0.95, centered. Gradient 90deg from #f2f2f7 to #7c6cff to #f0abfc back to #f2f2f7. background-size 200% 100%. Page #08080d. ## Behavior Animate background-position to 100% 0. Use background-clip: text and color transparent. ## Design tokens - Stops #f2f2f7, #7c6cff, #f0abfc; page #08080d. ## Motion - Duration 3.2s, linear, infinite alternate. ## Constraints - Single self-contained HTML file. No libraries. CSS only. - Honor prefers-reduced-motion: reduce by skipping the loop and leaving a readable static frame - Readable at 390px width with no horizontal page scroll
The code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { min-height: 100%; }
body {
background: #08080d; color: #f2f2f7; font-family: Inter, system-ui, sans-serif;
min-height: 100vh; overflow: hidden;
}
.hint { position: absolute; left: 16px; top: 16px; z-index: 5; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #8a8a99; }
main { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; } h1 { font-size: clamp(36px, 7vw, 84px); letter-spacing: -0.05em; line-height: 0.95; background: linear-gradient(90deg, #f2f2f7, #7c6cff, #f0abfc, #f2f2f7); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: slide 3.2s linear infinite alternate; } @keyframes slide { to { background-position: 100% 0; } }
@media (max-width: 420px) {
.hint { font-size: 10px; letter-spacing: 0.08em; }
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
</style>
</head>
<body>
<main><h1>Color that moves only through the type.</h1></main>
<script>
</script>
</body>
</html>About this effect
Background-clip text with a 200% gradient that animates background-position over 3.2s, linear, infinite alternate. The headline stays selectable and readable.
Similar effects
Scramble / Decode Text
Headlines that decode from random characters into the final message, with hover re-trigger.
Split Text Reveal
Characters rotate up from masked lines in a cascading GSAP stagger. No paid plugins.
Typewriter Code
A code editor that types itself, syntax-highlights each line, then deletes and loops.