CSS Text Effects: Gradients, Shadows & Transforms
Plain text gets the job done, but CSS gives you tools to make typography expressive without touching an image editor. This guide covers gradient text, layered shadows, neon glows, 3D effects, transforms, and animated type — all with pure CSS.
- Master CSS text effects: gradient text, text shadows, 3D transforms, glowing text, and animated typography.
- Covers gradient text.
- Covers text shadow basics.
- Covers layered & multi-shadow effects.
- Covers glowing & neon text.
Gradient Text
Gradient text is one of the most popular typographic effects on the modern web. The technique applies a background gradient to an element, then clips it to the text shape so the gradient only appears through the letterforms.
The core technique
Three CSS properties work together to create gradient text. First, you apply a gradient as the element's background. Then you set background-clip: text to clip the background to the text shape. Finally, you make the text itself transparent so the gradient shows through:
The -webkit- prefixed properties are still necessary for cross-browser support, including in Chrome, Safari, and Edge. Firefox supports the unprefixed version but also recognizes the prefixed form.
Multi-color gradient text
You can use any number of color stops, just like a regular gradient background. A rainbow effect works especially well for headings and hero sections:
Animated gradient text
To animate gradient text, use an oversized background and shift its position with a keyframe animation. The trick is setting background-size to something larger than 100% so there's extra gradient to scroll through:
Text Shadow Basics
The text-shadow property adds one or more shadows to text. Each shadow is defined by horizontal offset, vertical offset, blur radius, and color:
-webkit-backdrop-filter alongside backdrop-filter for Safari support. Without the prefix, the effect is invisible to roughly 25% of mobile users.The blur radius is optional and defaults to zero, which produces a hard, crisp shadow. Larger blur values create softer, more diffused shadows. Negative offset values move the shadow left or upward.
Unlike box-shadow, text shadows don't have a spread value and there's no inset keyword. The shadow follows the exact shape of each glyph, which makes it ideal for typographic effects rather than container-level shadows.
Layered & Multi-Shadow Effects
You can apply multiple text shadows by comma-separating them. The first shadow in the list renders on top. Stacking several shadows with increasing offsets creates depth:
backdrop-filter inside a position: fixed element can cause severe scroll performance issues. Test thoroughly on real iOS devices.This layered approach simulates a letterpress or embossed look. Each shadow layer darkens slightly, and the final layer adds a soft blur for realism. You can also use different colors per layer for a chromatic shadow effect.
Retro/vintage text shadow
Glowing & Neon Text
Neon glow effects rely on multiple text shadows with zero offsets and increasing blur radii. By layering several blurred shadows in the same bright color, you simulate the way neon light bleeds outward:
For a more realistic neon look, set the text color to white or a very light tint of the glow color, then use a slightly darker shade for the shadow layers. This mimics how a real neon tube has a bright white core with colored light radiating outward.
Pulsing neon animation
Combine the glow technique with a CSS animation to create a pulsing neon sign. Animate the text-shadow blur values up and down for a flickering effect:
3D Text with Shadows
By progressively stacking many thin shadow layers, you can create the illusion of extruded 3D text. Each layer shifts by one pixel and darkens slightly to simulate depth:
The hard shadow layers (without blur) create the extruded face, while the blurred layers at the end add a realistic drop shadow beneath the 3D text. This technique works best with bold, heavy fonts where the letterforms are thick enough to read the depth.
Text Stroke & Outline
The -webkit-text-stroke property draws an outline around each letter. Combined with transparent text, it creates a hollow outlined effect that's popular in modern hero sections:
You can also fill the text with a gradient while keeping the stroke, or use a gradient stroke by layering it with background-clip: text. Note that -webkit-text-stroke is not part of any CSS specification but has widespread browser support.
Fallback approach using text-shadow
For browsers that may not support text-stroke, you can approximate an outline using four directional text shadows with zero blur:
CSS Transforms on Text
CSS transforms let you rotate, scale, skew, and translate text elements. While transforms apply to the entire element (not individual characters), they're essential for creating dynamic layouts and hover effects.
Rotating text
Remember that transforms only work on block-level or inline-block elements. If you apply a transform to a plain span, you'll need to set display: inline-block first.
Skewed text for dynamic feel
3D perspective transforms
Adding perspective to text transforms creates a sense of depth. The perspective property on a parent element controls how pronounced the 3D effect appears:
Smaller perspective values (200–400px) create a more dramatic, exaggerated 3D effect. Larger values (800+) produce subtler, more realistic depth. Experiment with the CSS Transform Playground to preview these interactively.
Animated Text Effects
CSS animations and transitions can bring text effects to life. Here are a few practical patterns that add polish without overwhelming the user.
Hover color shift
Character-by-character reveal
For per-character animations you'll typically need JavaScript to wrap each letter in a span, then stagger the animation delay. However, CSS-only approaches work for fixed text using @keyframes with clip-path or width-based reveals:
Gradient shimmer sweep
A shimmer effect slides a highlight across text, commonly used for loading states or premium-feeling headings:
Performance Tips
Text effects are generally lightweight, but a few patterns can cause performance issues if you're not careful.
Animating text-shadow directly triggers repaints on every frame. If you're creating a pulsing or flickering effect, consider using opacity on a pseudo-element instead, since opacity changes are handled by the compositor and skip the paint step. Reserve direct text-shadow animation for subtle, low-frequency effects.
Gradient text with background-clip: text is well-optimized in modern browsers, but avoid applying it to massive blocks of body text — it's best suited for headings and short display text. On very long paragraphs, the clipping calculation can become expensive.
Multiple layered text shadows (especially 10+) on large font sizes can slow down rendering on low-end devices. If you're stacking shadows for a 3D effect, test on real hardware and consider reducing the layer count for smaller screens via media queries.
Combining Effects
The real power of CSS text effects comes from combining techniques. Here's a heading that uses gradient text, a subtle glow, and a slight skew for a dynamic, modern look:
Notice the use of filter: drop-shadow() instead of text-shadow here. When text has a transparent fill (as with gradient text), regular text-shadow renders behind the invisible text color and won't be visible. The drop-shadow filter applies to the rendered pixels — including the visible gradient — making it the right choice for adding glow to gradient text.
Use the CSS Text Gradient Generator, Text Shadow Generator, and CSS Transform Playground to create, preview, and copy code for all the effects in this guide.