Motion Implementation · Published · 5 min read
CSS Text Animation Examples: Headline Reveals and Link Effects
Start with a message people can read. These CSS text-animation patterns add a brief entrance or useful interaction feedback while preserving the actual words and layout.
Published by Amanjot Singh, founder of Scrollhaus. AI-assisted editorial work; product context, sources and corrections are documented in our editorial methodology.
Quick answer: CSS text animation is useful when it introduces a headline or clarifies an interaction without changing the message. Start with a short one-time reveal and a hover/focus underline. Keep the real words in HTML, reserve their space and provide a reduced-motion state. Use rotating words only when visitors can still understand the complete offer.
Open the working CSS text-animation demo. Replay the headline entrance, then focus the link with your keyboard. The examples use no external animation library.
Choose the effect around the reader's task
| Effect | Good use | Keep static |
|---|---|---|
| One-time headline reveal | Introduce one message at the start of a section | The essential offer and its meaning |
| Link underline | Make a hovered or focused destination easier to recognise | The link label and keyboard focus indicator |
| Staggered lines | Lead attention through a short editorial statement | Reading order and complete accessible text |
| Rotating words | Show a few genuinely related services | A full description for people who miss a cycle |
A portfolio title and a checkout instruction need different treatment. The first can introduce your style; the second must be immediately understandable. Avoid animating every paragraph or forcing people to wait through a sequence to discover the call to action. Use the hero-section patterns guide to decide where motion earns its place.
Example 1: a one-time CSS headline reveal
Keep the headline as normal text, with one span as the visual animation layer:
<h1 class="demo-title">
<span class="reveal">Make the message move.</span>
</h1>
<style>
.demo-title { max-width: 16ch; }
.reveal { display: inline-block;
animation: text-enter 450ms ease-out both; }
@keyframes text-enter {
from { opacity: 0; transform: translateY(12px); }
to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
.reveal { animation: none; opacity: 1; transform: none; }
}
</style>
This is an entrance on load, not a scroll-triggered reveal. The span occupies its normal layout space throughout the transition. The small translation changes the visible position, while the opacity changes how it appears; no script replaces or retypes the words. The final state stays readable after the animation ends.
When the heading appears far below the fold, an entrance on load may finish before the visitor reaches it. Use a visibility trigger for that case, but keep the default text visible if JavaScript fails. The GSAP ScrollTrigger examples show coordinated scroll interactions. Choose that workflow when a section needs a timeline rather than adding a library solely for this small reveal.
Example 2: animate a link underline without moving its label
<a class="demo-underline" href="/work/">Explore the work</a>
<style>
.demo-underline { position: relative; display: inline-block;
text-decoration: none; }
.demo-underline::after { content: ""; position: absolute;
bottom: 0; left: 0; width: 100%; height: 2px;
background: currentColor; transform: scaleX(0);
transform-origin: left; transition: transform 180ms ease; }
.demo-underline:hover::after,
.demo-underline:focus-visible::after { transform: scaleX(1); }
.demo-underline:focus-visible { outline: 3px solid currentColor;
outline-offset: 5px; }
@media (prefers-reduced-motion: reduce) {
.demo-underline::after { transition: none; }
}
</style>
Replace /work/ with a real destination. The same selector responds to mouse hover and keyboard focus. Keep an obvious focus outline and enough contrast between the link and background. For responsive menu behavior rather than one editorial link, use the animated navbar tutorial.
Example 3: stagger lines without splitting the reading experience
Wrap complete phrases rather than inserting a separate element for every letter. Keep the heading's text in its intended reading order. Use a short delay on the second line, such as animation-delay: 80ms, with the same reveal animation. Remove both delays and motion for the reduced-motion state.
Do not hide the only copy behind a long stagger, clip letters so tightly that accents disappear, or put punctuation into a different reading order. Test translated copy and narrow screens: a deliberate two-line heading may become four lines. Build the layout around the text rather than a fixed screenshot of it.
When rotating text needs a separate approach
A rotating headline changes the visible word rather than merely revealing a stable message. Reserve room for the longest phrase, keep a complete static description available and let people pause ongoing movement. Do not repeatedly announce intermediate words through a live region. The rotating-text guide handles those choices in detail.
An animated number is another distinct problem: the displayed value has to end at a truthful target. Read the number count-animation guide instead of treating a statistic as decorative text. Animating fictional customer results does not turn them into evidence.
Keep text animation readable and lightweight
- Animate one meaningful phrase at a time; leave supporting copy immediately readable.
- Use the real content and actual font when checking wrapping.
- Keep the animation's final state visible, including after a route transition.
- Do not make text meaning depend on a gradient that may lose contrast.
- Measure the page on a real phone; a small CSS example does not establish a whole page's performance.
- Keep forms, error messages and prices static unless motion clearly improves feedback.
In a bento-grid landing page, one animated heading can guide attention to the lead tile while other tiles remain still. In a portfolio, it should support the case studies rather than compete with them. The portfolio examples guide helps match typography, work previews and hierarchy.
A practical AI-builder prompt
Add a one-time 450ms transform-and-opacity entrance to the main heading and a short underline transition on link hover and visible keyboard focus. Keep the full message in semantic HTML, preserve its layout space and disable nonessential motion when prefers-reduced-motion is reduce. Do not add looping words, typewriter timers or an animation dependency. Show the desktop, narrow-screen and reduced-motion results.
Use Scrollhaus text and motion effects to compare directions and AI website design prompts to turn the chosen effect into a clearer brief. For the surrounding page, start with a design template whose hierarchy already fits your content.
Check the final page
Reload with reduced motion enabled, use Tab to focus every link and inspect a narrow viewport with your longest real heading. Confirm that copy remains visible if styles or scripts fail. If you add scrolling, repeated motion or replacement words, test those as separate interactions instead of assuming the simple demo covers them.
References: MDN CSS animation, MDN animation fill modes and MDN reduced motion.
Frequently asked questions
Do CSS text animations need an animation library?
Simple reveals and underline transitions can use CSS alone. Coordinated scroll timelines or interactive replacement text may need additional logic.
How do I stop text animation for reduced motion?
Use prefers-reduced-motion: reduce to remove nonessential animation and leave the final text visible. Keep the content and links usable in that state.
Is a rotating headline the same as a text reveal?
No. A reveal introduces stable words; a rotating headline changes them. Replacement text needs extra care for readable timing, stable space and ongoing motion controls.
Browse Scrollhaus website designs and build resources →
Need help with a template, account, or project? Email admin@scrollhaus.ai.