New: remix a demo site in your browser – no sign-up, nothing to install. Try it

← Blog

Text reveal animation #css: four ways to build it

· 10 min read

Key takeaways

  • Pure CSS handles any text reveal that plays once on load or on a single scroll trigger, with no JavaScript dependency.
  • GSAP with ScrollTrigger is required for scrubbed, pinned, or per-word staggered reveals that track scroll position.
  • Framer Motion only fits React projects and is the wrong tool for theme-based WordPress builds.
  • After Effects text reveals export via Bodymovin as Lottie JSON, best reserved for client-supplied files or complex choreography.
  • Wrap every reveal in a prefers-reduced-motion query and avoid splitting whole pages into per-character spans for accessibility.

A text reveal animation #css built with pure CSS needs no JavaScript and works in any WordPress theme or builder, but it caps out at simple word-by-word fades. GSAP adds scroll control, Framer Motion fits React builds, and After Effects exports handle handwriting effects. This guide builds the same reveal in all four, then scores them so you can pick per project.

When is plain CSS enough for a text reveal animation?

Plain CSS is enough when the reveal happens once, on page load or on a single scroll trigger, with no scrubbing and no sequencing. If you can describe the effect as "when this element enters the viewport, animate it", CSS handles it with no JavaScript dependency and nothing for a client to break.

The 15-line CSS snippet (copy-paste)

.reveal {
  animation: reveal-up 0.8s ease-out both;
}
@keyframes reveal-up {
  from { clip-path: inset(0 0 100% 0); transform: translateY(20px); }
  to   { clip-path: inset(0); transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; }
}

The clip-path line wipes the text upward while it slides into place. The prefers-reduced-motion query, documented in the MDN guide to using CSS animations, switches the effect off for users who ask for less motion. For a hero headline that animates once on load, this is the whole job. If you want the same reveal tied to scroll position instead, the WordPress-specific setup is covered in text reveal on scroll for WordPress.

What CSS cannot do: scrubbing and per-word stagger on scroll

CSS animations run on a fixed timeline. They cannot tie progress to scroll position, so a line that fills in as the user scrolls is out of scope. Per-word stagger is possible with animation-delay on split spans, but each word needs its own element and delay, which gets tedious past a headline or two. Sequencing multiple lines, syncing to scroll, and reversing on scroll-up all need JavaScript, which the next sections cover.

How does a GSAP text reveal differ from a CSS-only one?

CSS gives you a one-shot transition: the element hits a trigger point, the animation plays, it's done. GSAP gives you a timeline you can scrub, meaning the animation tracks the scrollbar itself. Scroll to the halfway point and the reveal sits at the halfway point. That single difference changes what you can build: word-by-word reveals that advance with reading position, lines that draw in as a section enters and reverse as it leaves, and pinned scenes where a headline holds still on screen while its words animate through several states.

The cost is a JS dependency and a learning curve. You're writing JavaScript, loading the GSAP and ScrollTrigger libraries, and debugging timing instead of keyframes. For a single fade-up on a hero, that trade rarely makes sense. For anything scrubbed, split, or pinned, CSS can't do the job at any size. If you want pinned scrolling in WordPress without hand-writing the timeline, the guide to sticky scroll animation in WordPress covers where a builder handles it for you.

The same reveal in GSAP (copy-paste)

<h1 class="reveal">Words that arrive one by one</h1>
<script src="https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gsap@3/dist/ScrollTrigger.min.js"></script>
gsap.registerPlugin(ScrollTrigger);

gsap.from(".reveal", {
  y: 40,
  opacity: 0,
  duration: 0.6,
  stagger: 0.08,
  scrollTrigger: {
    trigger: ".reveal",
    start: "top 80%",
    toggleActions: "play none none reverse"
  }
});

The stagger value is what CSS can't match without splitting the text into spans yourself. GSAP treats the headline as words and offsets each one on a shared timeline.

When the extra weight pays for itself

Reach for GSAP when the reveal must respond to scroll position rather than scroll events, when you need per-character or per-word splitting, or when the animation is part of a longer sequence with pins and multiple triggers. One honest caveat: if your whole site is a single hero reveal on a Kadence or GeneratePress build, the two scripts cost more than they return, and the CSS-only version from the previous section is the better call. Midground itself ships GSAP-style scroll motion without asking you to write the timeline, but if your project is one static reveal, any tool is overkill.

When should you reach for Framer Motion instead of CSS or GSAP?

Framer Motion is the right call in exactly one situation: you are working inside a React project. It animates React components through props and hooks, so it needs React's rendering cycle to exist. On a WordPress site built with Astra, Kadence, GeneratePress or Elementor, there is no React tree to attach to, so Framer Motion is the wrong tool. Skip it and use CSS or GSAP instead.

The same reveal in Framer Motion (copy-paste)

import { motion } from "framer-motion";

<motion.h2
  initial={{ opacity: 0, y: 24 }}
  whileInView={{ opacity: 1, y: 0 }}
  viewport={{ once: true }}
  transition={{ duration: 0.6 }}
>
  Revealed on scroll
</motion.h2>

whileInView replaces the scroll-trigger wiring you would do by hand in CSS or with a library.

Why it rarely fits a WordPress build

You can run React inside WordPress, but you are then maintaining a build step on every client site, which is the opposite of a clean, fast handover. If you need scroll-linked scenes, GSAP with ScrollTrigger works anywhere JavaScript runs, and its docs cover the trigger API and licensing terms in detail: GSAP ScrollTrigger docs. If you would rather not write JavaScript at all, a purpose-built theme handles it for you, as covered in this guide to Apple-style scroll pages on WordPress.

Can you import an After Effects text reveal to the web, and how?

Yes, through the Bodymovin plugin, which exports your After Effects composition as a Lottie JSON file. You then drop the file on your server and render it with a small player script, or embed it in WordPress via a Lottie block if your builder supports one. The animation plays back frame-accurate to your AE timeline.

Export path: After Effects to Lottie to the page

The workflow: animate your text in After Effects, install Bodymovin, export to JSON, upload it, and render it in a container sized to your layout. Keep the composition simple. Masked text layers and mattes survive the export; many effects, especially some 3D and blurs, do not, so test early.

When an AE export is worth it (and when it is not)

Worth it when a client supplies an AE file, or when you need hand-timed, multi-layer choreography that CSS cannot express. Not worth it for a simple line-by-line text reveal: the JSON adds kilobytes, the text is no longer editable on the page, and it will not reflow responsively. For most WordPress builds, a CSS or GSAP approach is the faster, more maintainable call. If you want scroll-driven reveals inside your builder workflow, our guides at https://midgroundwp.com/guides/ cover the alternatives.

Which text reveal method should you pick? A decision rubric

Score each approach on the four things that actually decide a client project: how much code ships, how it performs, who can maintain it, and how it fits a builder stack.

MethodCode shippedPerformanceMaintenanceWordPress fit
Pure CSSA few linesBest; no JSAnyone on the teamWorks in any theme or block
GSAP / ScrollTrigger~20KB libraryExcellent with scrub timelinesNeeds JS comfortEnqueue in a child theme
Framer MotionReact dependencyGood, but React requiredReact devs onlyPoor; Elementor and GeneratePress are not React
After Effects exportOften largestVaries by exporterLocked to the exportAwkward in any builder

Framer Motion is the clearest cut: its official docs require React, so it only makes sense on a React-based build, not a theme-based WordPress stack.

For most client work: CSS for simple reveals, GSAP for pinned or scrubbed sequences, and skip the other two. If you want scroll motion without writing either, Midground's parallax guide covers the builder-native route, and Midground itself handles pinned scenes with no code. Honest gap: Midground cannot match GSAP's timeline control for bespoke easing.

How do you build a handwriting text reveal animation?

SVG stroke technique (copy-paste)

You need the text as an SVG path, because CSS cannot animate the strokes of a webfont. Convert the lettering to outlines in Illustrator, Inkscape, or a tool like Font SVG converters, then animate stroke-dashoffset so the line draws itself:

.handwrite path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 2.5s ease forwards;
}
@keyframes draw {
  to { stroke-dashoffset: 0; }
}

Set pathLength="1" on each path so dasharray: 1 works regardless of path length. Stagger with animation-delay per path for a natural writing rhythm.

Getting the path: fonts, handwriting SVGs, and limits

No font-to-path conversion happens in the browser, so every word must be pre-outlined. Handwriting SVGs from sites like Scripted SVG or traced scans work, but long paragraphs become huge files. This is a one-off effect for headlines and signatures, not body text. In a WordPress stack, drop the inline SVG into an HTML block or builder code widget; it needs no JavaScript, so it runs anywhere, including Elementor and GeneratePress layouts. Screen readers get nothing from a traced path, so add aria-label with the real text.

Where do you find and remix text reveal animation CodePen examples?

Search terms that actually surface good pens

Skip "text reveal animation" on its own; it returns noise. Try "split text scroll", "clip-path text reveal", or "GSAP SplitText stagger" and sort by popularity. Favour pens with a short HTML section, comments in the CSS, and no external dependencies beyond one library. If the pen loads five scripts to animate three words, move on.

Porting a pen into WordPress without breaking the page

Copy the pen's CSS into your child theme's stylesheet and its JS into a single file enqueued on that page only, not site-wide. Match the library version the pen uses; a GSAP pen written for 3.x can fail on an older copy already loaded by your theme. If you are on Elementor, paste the markup into an HTML widget and check the reveal still fires after the builder's own scripts run.

One exception: pens that export After Effects compositions as JSON rely on the Lottie player, and file size grows quickly with each animated layer, so check the Lottie documentation before shipping one to a client page.

Which text reveal method performs best on mobile and for accessibility?

Pure CSS wins on mobile: it animates on the compositor, works without JavaScript, and fails gracefully. GSAP comes second, as long as you gate it. Lottie and After Effects exports cost the most on low-end phones because every frame is decoded and painted. Per-character splitting multiplies DOM nodes, which slows rendering and confuses screen readers.

prefers-reduced-motion in one snippet

Wrap every approach in this and ship it every time:

@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; opacity: 1; transform: none; }
}

For GSAP, check gsap.matchMedia() and skip the timeline when the query matches. The text should simply appear.

DOM size and screen-reader pitfalls

Splitting a headline into spans per word or letter is fine for one heading. Do it across a whole page and assistive tech announces fragments instead of sentences. Keep the full sentence in an aria-label or split by word, not character. Midground takes the same trade-off: pinned scenes add nodes, so we limit them to hero sections and keep body text static.

FAQ

What is the easiest text reveal animation in CSS for beginners?

A clip-path wipe combined with a slide-up keyframe. Add one class to your heading, paste the keyframes, and the text wipes into view on page load. There is no JavaScript to load and no library to break, so the whole effect lives in roughly 15 lines of CSS you can drop into any stylesheet.

How do I add a text reveal animation to WordPress without a plugin?

Paste the CSS snippet into your child theme's stylesheet or the Customizer's Additional CSS panel, then add the reveal class to your heading in the block editor or builder. Because the effect is pure CSS, it works in any theme and needs no enqueueing, no build step, and no plugin to maintain.

Is GSAP free for commercial client websites?

Yes for the core library and ScrollTrigger, which are free to use on commercial projects. Some bonus plugins historically required a paid Club membership, so check the license terms on gsap.com for the specific plugin you need. Budget for the ~20KB script weight and a developer comfortable debugging JavaScript timelines.

Why is my CSS text reveal animation not working in Elementor?

Elementor injects its own markup and scripts after the page loads, so animations tied to load order can fire before the widget renders, or a conflicting library version can interfere. Paste your CSS into Elementor's Custom CSS or Additional CSS, put the markup in an HTML widget, and verify the reveal still triggers after the builder's scripts run.

How do I make text appear word by word on scroll?

In pure CSS, split the headline into spans and stagger each word with animation-delay, which gets tedious past a headline or two. For reveals that track scroll position itself, GSAP's stagger property on a ScrollTrigger timeline offsets each word automatically, and its reverse-on-scroll behavior comes free with the trigger configuration.