CSS gradient text uses background-clip: text to mask a gradient through the shape of a letterform — the gradient becomes the visible fill, the text becomes the clipping mask. These 20 hand-coded designs cover the full modern playbook — animated @property flow, aurora sweep, conic hue spin, per-letter rainbow wave, neon glow, outline stroke, metallic chrome/gold/copper, holographic foil, duotone, texture fills, cursor-tracked radials, glitter sparkle and more. Every demo uses scoped .gt-NN class names that never collide with your existing styles, honours prefers-reduced-motion, and ships under the MIT license.

16 pure CSS4 light JSPublished

Related20 CSS Text Gradient Effects20 CSS Neon Text Effects30 CSS Text Animations

CSS Animated Gradient Text Flow — preview
01 / 20Pure CSS

CSS Animated Gradient Text Flow

A flowing rainbow gradient sweeps across bold display text using a horizontally-extended linear-gradient and background-position animation for a seamless loop.

Published

CSS Aurora Borealis Gradient Text Sweep — preview
02 / 20Pure CSS

CSS Aurora Borealis Gradient Text Sweep

An aurora-inspired diagonal gradient sweeps across a headline using animated background-position on a multi-stop linear-gradient with teal, violet, and emerald hues.

Published

CSS Conic Gradient Text Hue Spin — preview
03 / 20Pure CSS

CSS Conic Gradient Text Hue Spin

Full-spectrum hue rotation applied to conic-gradient-filled text, creating a continuously spinning rainbow prism effect driven by a CSS filter animation.

Published

CSS Rainbow Wave Per-Letter Gradient Text — preview
04 / 20Pure CSS

CSS Rainbow Wave Per-Letter Gradient Text

Each letter bounces on its own phase-offset translateY wave while carrying a unique hue-stop pair, producing a travelling rainbow wave entirely in CSS.

Published

CSS Lava Lamp Radial Gradient Text — preview
05 / 20Pure CSS

CSS Lava Lamp Radial Gradient Text

A slowly drifting radial gradient simulates molten lava inside the text glyphs, using animated CSS custom properties to move the gradient hotspot.

Published

CSS Neon Pulse Gradient Text Glow — preview
06 / 20Pure CSS

CSS Neon Pulse Gradient Text Glow

A scrolling cyan-magenta-lime gradient combined with a pulsing drop-shadow glow recreates the flickering neon sign aesthetic entirely in CSS.

Published

CSS Gradient Text Outline Stroke Effect — preview
07 / 20Pure CSS

CSS Gradient Text Outline Stroke Effect

A gradient is applied as the stroke colour of outlined text using -webkit-text-stroke combined with background-clip:text, creating crisp gradient-coloured letterform outlines.

Published

CSS Metallic Chrome Gold Copper Gradient Text — preview
08 / 20Pure CSS

CSS Metallic Chrome Gold Copper Gradient Text

Vertical multi-stop linear gradients mimic the specular highlights of chrome, gold, and copper metal surfaces clipped to display text.

Published

CSS Holographic Foil Iridescent Gradient Text — preview
09 / 20Pure CSS

CSS Holographic Foil Iridescent Gradient Text

A dense multi-stop rainbow gradient animating diagonally across text and card surfaces recreates the colour-shifting prismatic effect of holographic foil stickers.

Published

CSS Duotone Gradient Text Two-Colour Fill — preview
10 / 20Pure CSS

CSS Duotone Gradient Text Two-Colour Fill

Bold typography filled with two-stop duotone linear gradients, with animated letter-spacing expansion that makes each pairing feel alive and cinematic.

Published

CSS Gradient Text Texture Fill — Sunset Starfield Ocean — preview
11 / 20Pure CSS

CSS Gradient Text Texture Fill — Sunset Starfield Ocean

Multi-stop gradients simulate natural texture fills — a sunset sky, a star-dotted night, and an ocean depth — each clipped to large display text.

Published

CSS Liquid Mercury Metallic Gradient Text — preview
12 / 20Pure CSS

CSS Liquid Mercury Metallic Gradient Text

A cool blue-grey metallic gradient with rippling background-position animation and teardrop orbs below the headline evoke the look of flowing liquid mercury.

Published

CSS Hover Reveal Gradient Text Effect — preview
13 / 20Pure CSS

CSS Hover Reveal Gradient Text Effect

Each line of text sits in a muted grey state until hovered, triggering a smooth transition that unveils a distinct gradient per line using -webkit-text-fill-color toggling.

Published

CSS Toggle Switch Gradient Text Colour Picker — preview
14 / 20Pure CSS

CSS Toggle Switch Gradient Text Colour Picker

Three checkbox-driven toggle switches independently enable gradient fills on individual words, demonstrating CSS state-driven gradient text with zero JavaScript.

Published

CSS Scroll Gradient Text Reveal on Scroll — preview
15 / 20CSS + JS

CSS Scroll Gradient Text Reveal on Scroll

Each section's headline fades in from below with a gradient fill sliding from washed-out to vivid, triggered by IntersectionObserver as the element enters the viewport.

Published

CSS Click Ripple Gradient Text Interaction — preview
16 / 20CSS + JS

CSS Click Ripple Gradient Text Interaction

Clicking the gradient headline spawns a ripple ring at the click point while the headline flashes brighter, demonstrating CSS keyframe injection via JavaScript.

Published

CSS Cursor-Tracked Radial Gradient Text — preview
17 / 20CSS + JS

CSS Cursor-Tracked Radial Gradient Text

A radial gradient spotlight follows the cursor position inside the demo, illuminating text from the exact point the mouse hovers, driven by CSS custom properties updated in JavaScript.

Published

CSS Typewriter Loop Gradient Text Animation — preview
18 / 20CSS + JS

CSS Typewriter Loop Gradient Text Animation

A typewriter loop cycles through a curated list of words letter by letter, each rendered in a continuously scrolling gradient, with a blinking cursor and word chip indicators.

Published

CSS Glitter Sparkle Gradient Text Effect — preview
19 / 20Pure CSS

CSS Glitter Sparkle Gradient Text Effect

Gold-pink-violet gradient text paired with animating spark particles via absolute-positioned siblings and staggered scale/opacity keyframes recreates the glitter foil aesthetic.

Published

CSS Crystalline Prism Gradient Text — preview
20 / 20Pure CSS

CSS Crystalline Prism Gradient Text

A pastel multi-stop gradient mimics the delicate refractive colours of crystal or cut glass, with animated background-position movement and complementary facet stripe accents.

Published

FAQ

Frequently asked questions

What is CSS gradient text and how does it actually work?
CSS gradient text uses the background-clip: text property to mask a gradient through the shape of a letterform — the gradient becomes the visible fill while the text glyph becomes the clipping mask. The canonical four-line recipe: (1) set a background to your gradient on the text element, (2) set background-clip: text AND -webkit-background-clip: text (Safari + older Chrome still need the prefix in 2026), (3) set color: transparent OR -webkit-text-fill-color: transparent to make the text itself see-through, (4) the gradient now shows through the letter shapes. Demo #01 (Animated Gradient Text Flow) ships the modern @property --angle typed-custom-property version that animates smoothly (the older background-position trick is jerky because percentages can't be interpolated with sub-pixel precision). The technique works for any gradient: linear, radial, conic, repeating, or animated.
Which gradient text pattern should I pick for my use case?
Decision rule by intent. Hero headline / above-the-fold: Demo #01 (Animated Gradient Text Flow) for a subtle continuous shimmer, or Demo #02 (Aurora Borealis Sweep) for premium SaaS. Logo / brand mark: Demo #08 (Metallic Chrome Gold Copper) for luxury / premium, Demo #09 (Holographic Foil) for trendy / tech-forward, Demo #07 (Outline Stroke) for editorial. CTA / button text: Demo #06 (Neon Pulse Glow) for cyberpunk / gaming, Demo #13 (Hover Reveal) for understated interactivity. Editorial / magazine headline: Demo #10 (Duotone) for art-direction restraint, Demo #11 (Texture Fill — Sunset / Starfield / Ocean) for image-style fills without an actual PNG. Interactive / playful: Demo #04 (Per-Letter Rainbow Wave) for kid-friendly apps, Demo #17 (Cursor-Tracked Radial) for design-forward marketing, Demo #19 (Glitter Sparkle) for celebration moments. Tech / data / dashboards: Demo #03 (Conic Hue Spin) for analytics, Demo #12 (Liquid Mercury) for fintech / crypto. Demo / showcase / scroll page: Demo #15 (Scroll Reveal) for storytelling, Demo #18 (Typewriter Loop) for landing-page rotators. All 20 demos use scoped .gt-NN class names so you can drop multiple onto the same page without conflicts.
Why use background-clip: text instead of a gradient image PNG?
Three reasons. 1. Editable: change the gradient colors / angle / stops in milliseconds via CSS — no Photoshop, no re-export. 2. Crisp at any size: PNGs pixelate above their source resolution; CSS gradients are vector-rendered and stay sharp at any zoom level, on any DPI screen (retina, 4K, the new 8K displays). 3. Performant: an inline CSS gradient is ~50 bytes in your stylesheet; a PNG screenshot of the same text at 2x retina is 8-40KB and adds an HTTP request. Page-weight savings compound across a marketing page with several headline elements. 4. Animatable: a PNG can't shimmer, sweep aurora, or track your cursor — gradient text can. 5. Selectable + accessible: gradient text is real <h1> / <p> content — selectable by the user, indexable by Google, readable by screen readers, translatable by Google Translate / DeepL. A PNG is just an image; even with alt text, search engines and assistive tech can't extract the actual words. The only reason to use a PNG is if you need exact pixel-perfect rendering of a custom font with effects no CSS technique can produce (e.g. distressed grunge texture from a 3D render). For 99% of marketing UI, gradient text wins on every dimension.
Is gradient text WCAG-accessible? Doesn't it fail contrast?
It CAN fail contrast easily — the gradient varies across the text, so depending on the stops, parts of the letter may sit at 1.5:1 or 2:1 contrast against the page background. WCAG 2.2 AA requires 4.5:1 for body text and 3:1 for large text (24px+ regular, 18.66px+ bold). To keep gradient text compliant: (1) Use gradient text only on large display sizes (40px+, ideally 60px+ for hero headlines) where the 3:1 threshold applies — the lower bar makes mid-gradient sections more forgiving. (2) Pick gradient stops where the worst single point still clears 3:1 against your page background — test it with axe DevTools, Lighthouse, WAVE, or the WebAIM contrast checker by sampling the lightest and darkest pixel in your gradient. (3) For body-size text (16px), use solid color, not gradient — the WCAG 4.5:1 threshold is too narrow for safe gradient implementation. (4) Add a high-contrast fallback color that solid-fills the text when background-clip isn't supported or when prefers-reduced-motion is set (some users with cognitive disabilities find gradient text harder to read). The CSS recipe: color: #fff; background: ...; background-clip: text; -webkit-text-fill-color: transparent; — if background-clip fails, the color: #fff falls back gracefully. Regulatory frameworks that mandate WCAG compliance: EU EAA (European Accessibility Act, enforceable June 2025), US Section 508, Canada ACA, UK Equality Act.
Browser support — does background-clip: text still need the -webkit- prefix in 2026?
Yes, awkwardly. Spec-compliant background-clip: text reached Chrome 120+, Firefox 117+, and Safari 18.2+ — but you should still ship BOTH declarations in 2026 because Safari on iOS lags behind desktop Safari by ~6 months on user adoption (most users haven't updated past iOS 17 yet). The canonical recipe in modern code: background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; The -webkit-text-fill-color: transparent is the older Safari/Chromium way of making text see-through; modern code can use just color: transparent instead, but the -webkit-text-fill-color version takes precedence over color inheritance in some edge cases (forms, inputs) so it's the safer cross-browser default. Caniuse data: as of mid-2026, ~96% of global browser usage supports unprefixed background-clip: text; the 4% gap is iOS Safari < 16.4 and Samsung Internet < 23. Shipping both declarations costs you 30 bytes per element — cheap insurance. The Animated Gradient Flow demo (#01) ships both.
How does gradient text compare to Tailwind / shadcn / MUI / Chakra / styled-components gradient text recipes?
Tailwind v3 / v4: the canonical recipe is bg-gradient-to-r from-violet-500 to-pink-500 bg-clip-text text-transparent — Tailwind doesn't have a single utility for 'gradient text', you assemble three utilities. Our CSS to Tailwind converter outputs this combination automatically when you paste a gradient-text CSS rule. shadcn/ui: doesn't ship a gradient-text primitive; you write the Tailwind classes inline or in a custom component. MUI / Material UI: pass the gradient via sx prop — sx={{ background: 'linear-gradient(...)', WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent' }}. The camelCased React style names hide the -webkit- prefix. Chakra UI: similar pattern via the bgGradient prop + bgClip='text' — Chakra ships this as a first-class shorthand, which is nice. Ant Design / Mantine: no first-class gradient-text component; same React-inline pattern as MUI. styled-components / Emotion: identical to plain CSS inside the template literal. For complex effects (per-letter wave, cursor-tracked, scroll-reveal): every framework requires the same custom JS that we ship in the demo's JS tab — copy it as-is. The CSS-in-JS layer doesn't change the underlying technique.
Why does my gradient text disappear when I add a text-shadow?
Because -webkit-text-fill-color: transparent (or color: transparent) makes the text glyph transparent — text-shadow then casts the shape of TRANSPARENT pixels, which means the shadow shows through and over the gradient, often producing visual chaos. The fix: use filter: drop-shadow() on the parent element instead of text-shadow on the text itself. drop-shadow respects the gradient-filled appearance because it operates on the rendered pixels, not the glyph alpha channel. The Neon Pulse Glow demo (#06) ships this pattern: filter: drop-shadow(0 0 8px rgba(255, 0, 255, 0.6)) wraps the gradient text in a magenta glow without breaking the fill. Performance note: drop-shadow is more expensive than text-shadow (it creates a paint layer); use it sparingly on hero text, not body text. Multiple shadows: stack multiple drop-shadow filters: filter: drop-shadow(0 0 8px ...) drop-shadow(0 0 16px ...) — each is its own GPU-rendered layer.
How do I animate gradient text smoothly? My background-position animation looks jerky.
Animating background-position from 0% 50% to 100% 50% is the legacy 2018 recipe — it animates the gradient stops shifting across the text, but because percentage values aren't interpolated with sub-pixel precision on all browsers, you get visible stuttering, especially on retina screens. The modern fix: use @property to declare a typed custom property and animate THAT instead. @property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; } declares --angle as an actual <angle> value (not a string) so the browser can interpolate between angle values with sub-degree precision. Then write your gradient as linear-gradient(var(--angle), #f43f5e, #8b5cf6, #06b6d4) and animate --angle from 0deg to 360deg. Result: silky-smooth rotation at 120fps, GPU-accelerated, no main-thread cost. Demos #01 (Animated Flow) and #03 (Conic Hue Spin) both ship this pattern. @property is supported in Chrome 85+, Safari 16.4+, Firefox 128+ — for older browsers, fall back gracefully to the static gradient (the typed property degrades to undefined, so the gradient uses its initial value). The same trick works for any animatable gradient parameter: hue rotation, conic from-angle, radial position.
Can I use OKLCH and Display-P3 wide-gamut colors in gradient text?
Yes — and you should for production marketing pages on modern displays. OKLCH (Chrome 111+, Safari 16.4+, Firefox 113+) is a perceptually uniform color space — interpolating between two OKLCH colors produces visually smoother gradients than interpolating between two hex codes, because hex (sRGB) interpolation passes through muddy mid-gray midpoints. Example: linear-gradient(45deg, oklch(0.7 0.18 30), oklch(0.7 0.18 250)) produces a clean magenta→cyan sweep where the equivalent hex gradient would muddy through grey-purple. Display-P3 (Chrome 111+, Safari 15+, Firefox 113+) extends color into the wider P3 gamut available on every Apple device since 2018, recent Pixel phones, and high-end Windows laptops. Reds and greens are ~25% more saturated than sRGB. Example: color(display-p3 1 0 0) is a more vivid red than #ff0000. Cross-browser strategy: layered declarations — color: #ff0000; color: oklch(0.6 0.25 30); color: color(display-p3 1 0 0); — browsers ignore declarations they don't understand and use the last supported one. Modern color-mix() function (Chrome 111+, Safari 16.2+, Firefox 113+) lets you blend two colors at runtime: color-mix(in oklch, #f43f5e 60%, #8b5cf6) — useful for theme-aware gradient stops. Demos #02 (Aurora) and #09 (Holographic) use OKLCH gradients; Demo #20 (Crystalline Prism) uses color-mix for the prism refractions.
Are these gradient text designs free, and how should I attribute them?
Yes — all 20 designs are MIT licensed and free for personal and commercial use, including client projects, SaaS products, design systems, and open-source libraries. The MIT license requires only that you keep the copyright notice if you redistribute the source code as-is; in shipped production HTML / CSS that you've adapted, no visible attribution is needed. If you ship one as part of an open-source UI library or component kit, a one-line credit pointing to https://codefronts.com is appreciated but not legally required. Accessibility: every demo uses semantic HTML, honours prefers-reduced-motion: reduce (animations fall back to static gradients), and includes a high-contrast solid-color fallback for browsers that don't support background-clip: text. Verify your specific use case with axe DevTools, Lighthouse, WAVE, or WebAIM contrast checker before shipping to EU EAA / US Section 508 / Canada ACA / UK Equality Act audits — the demos are AA-compliant at large display sizes but body-text usage may need a different approach.

Related collections

9 CSS 3D Designs preview

9 CSS 3D Designs

9 hand-coded CSS 3D scenes built with real transforms, perspective, and preserve-3d — iridescent flip cards, a midnight coverflow carousel, kinetic tilt pricing cards, a page-turn flipbook, a Bauhaus drag-cube navigator, a modular synth control panel, a luxury hover-flip product showcase, a 5×5 spinning cube matrix, and a 60-orb DNA double helix. No WebGL, no libraries.

22 CSS Brutalism preview

22 CSS Brutalism

22 hand-coded brutalist and neubrutalist CSS designs covering the full spectrum of the aesthetic — from the anti-design brutalism of 2014-2018 (raw system fonts, zero border radius, monochrome density, visible structure) through to the neubrutalism of 2021-present (bright pastel fills, thick black borders, hard offset shadows with zero blur, rounded blocks). The neubrutalist half ships SaaS pricing cards with sticker badges, a pastel admin dashboard, signup forms, rotated feature cards, an offset-shadow navbar, a playful button set, a native dialog modal, a testimonial wall, blog cards, chunky toggles, a landing hero, an image gallery, stats panels and a rounded footer. The brutalist half covers product grids, raw form controls, a monochrome data dashboard, a portfolio index, indie SaaS pricing, Windows 95 desktop chrome, editorial long-read and a streetwear catalog. Every design is scoped under a .brt-NN prefix for no-collision pasting, guards prefers-reduced-motion, and ports unchanged to React, Vue, Svelte, Astro, Next.js and Tailwind.

22 CSS Dark Mode UI preview

22 CSS Dark Mode UI

22 hand-coded CSS dark-mode UI patterns — prefers-color-scheme root strategy, data-theme attribute override, color-mix token system, light-dark() function, sidebar navigation, dashboard card grid, modal dialog, focus-ring contrast audit, three-state switcher, code editor surface, OLED true black, layered slate, aurora dim and more.

Search CodeFronts

Loading…