Live preview · fully interactive
The prompt
Build a marker sweep behind one word. ## Look Headline clamp(28px, 5vw, 56px), tracking -0.04em, color #f2f2f7. The word prompt is a mark with a #7c6cff background sized to 0.55em tall, starting at width 0. Page #08080d. ## Behavior Animate background-size to 100% 0.55em from the left. ## Design tokens - Highlight #7c6cff; text #f2f2f7; page #08080d. ## Motion - Duration 0.7s, delay 0.4s, easing cubic-bezier(0.16, 1, 0.3, 1). ## 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; } h1 { font-size: clamp(28px, 5vw, 56px); letter-spacing: -0.04em; font-weight: 650; } mark { background: linear-gradient(#7c6cff, #7c6cff) left / 0% 0.55em no-repeat; color: #f2f2f7; animation: mark 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards; } @keyframes mark { to { background-size: 100% 0.55em; } }
@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>Copy the <mark>prompt</mark>, not a screenshot.</h1></main>
<script>
</script>
</body>
</html>About this effect
The word “prompt” sits on a violet highlight that scales from the left over 0.7s after a 0.4s delay. The rest of the sentence stays still.
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.