CSS gradients allow you to create stunning, smooth color transitions without the need for images. From subtle background effects to vibrant overlays and striking UI elements, gradients can add depth and visual interest to any design. In this collection, you’ll explore a variety of CSS gradient examples, including linear, radial, and conic gradients, each demonstrating creative applications like multi-color blends, hover effects, and dynamic color shifts.
113 CSS Gradient Examples
Rounded Triangle CSS Image Mask
demo & codeThis Rounded Triangle CSS Image Mask offers a mathematically perfect way to shape visuals into equilateral triangles with soft, professional edges. It is an ideal choice for high-end portfolio galleries, creative team sections, or landing pages where standard rectangular or circular crops feel too conventional. By leveraging modern CSS math, the shape remains perfectly symmetrical regardless of the image dimensions.
Mouse-Tracking Linear Shine Button
demo & codeThis Mouse-Tracking Linear Shine Button adds a high-end, tactile feel to your UI. Unlike standard hover effects that simply swap colors, this component tracks the user’s cursor position to drag a realistic light reflection across the button’s surface. Built with React and Tailwind CSS, it utilizes reactive CSS variables to control gradient positions, creating a dynamic lighting effect that feels physical and responsive.
Scroll-Driven Image Swapper
demo & codeThis Scroll-Driven Image Swapper demonstrates the bleeding edge of web animation. It uses the native CSS Scroll-driven Animations API to create a complex parallax-like effect where two columns of different heights scroll in sync. As you scroll, the images in the shorter column slide and crossfade to match the context of the taller column. Crucially, the code implements a Progressive Enhancement strategy: it checks for native browser support and falls back to GSAP ScrollTrigger for browsers that haven’t implemented the spec yet.
Semantic Custom Progress Bar Kit
demo & codeThis Semantic Custom Progress Bar Kit offers a robust way to display data visualization using a “semantic-first” approach. Instead of writing empty div soup, you define your data using standard HTML5 <progress> tags. The accompanying JavaScript then “hydrates” these tags, converting them into four distinct, visually rich styles ranging from simple solids to complex gradients and striped patterns, perfect for dashboards or skill portfolios.
Holographic 3D Interactive Card
demo & codeThis Holographic 3D Interactive Card is a premium UI component inspired by rare physical trading cards. It features a sophisticated depth effect where the logo floats independently from the iridescent background, reacting dynamically to mouse movements or touch input. The use of modern CSS APIs ensures high-performance rendering of complex gradients and masks, creating a truly immersive “collectible” feel for digital assets.
Geometric Custom Range Sliders
demo & codeThese Geometric Custom Range Sliders push the boundaries of form styling by abandoning the standard “circle on a line” look. Created by CSS math wizard Ana Tudor, this set utilizes SCSS trigonometry to generate complex thumb shapes (like triangles and hollow pills) and CSS Mask Composition to carve out negative space. The result is a set of distinct, scalable inputs that rely on a single HTML <input> tag without any wrapper divs.
Twitch Style Gradient Hover Card
demo & codeThis Twitch Style Gradient Hover Card brings a high-energy interactive element to your UI, perfect for feature highlights or gaming profiles. It combines a sliding background gradient that utilizes responsive vmin units with a JavaScript-powered staggered text reveal. The result is a fluid animation where the background shifts dynamically while the subtitle types itself in word by word.
Staggered Bars Reveal Animation
demo & codeThis Staggered Bars Reveal Animation creates a cinematic intro for landing pages using zero JavaScript. By orchestrating a single pseudo-element (::after) with complex linear-gradient backgrounds, the component simulates seven distinct bars sliding into place. The animation cleverly shifts the background-position of each gradient strip sequentially, creating a rhythmic “wipe” effect that culminates in the text appearing.
Blooming Night Garden Animation
demo & codeThis Blooming Night Garden Animation is a delightful example of “CSS Art,” where HTML elements are shaped into complex illustrations using code. It features a complete scene with a textured night sky, procedurally blooming flowers, swaying grass, and a particle system of floating hearts, all brought to life through choreographed CSS keyframes.
Staggered Gradient Skeleton Loader
demo & codeThis Staggered Gradient Skeleton Loader improves perceived performance by providing a visual structure while content fetches in the background. Unlike static placeholders, this Vue.js component utilizes a calculated delay system to create a “wave” animation across the grid, guiding the user’s eye naturally from top-left to bottom-right without using complex JavaScript animation libraries.
Border Image Fill Gradient Overlay
demo & codeThe Border Image Fill Gradient Overlay is a minimalist CSS technique used to add a decorative or functional gradient over background images. Unlike traditional methods that require extra HTML markup or ::before/::after pseudo-elements, this approach uses a single, underutilized property to enhance text contrast and visual depth.
Hyperplexed Evervault Card Hover Effect
demo & codeThis Hyperplexed Evervault Card Hover Effect utilizes dynamic character generation and CSS masking to create a high-tech “decryption” visual. It replicates the sophisticated card interactions found on the Evervault website, blending procedural text with mouse-responsive radial gradients.
Pure CSS Synthwave 80s Animation
demo & codeThis Pure CSS Synthwave 80s Animation captures the nostalgic aesthetic of the 1980s retrowave genre. It features a complete animated scene: an infinite neon grid, a setting sun with scanlines, shaking palm trees, and a DeLorean driving into the distance. The scene is brought to life with a driving synthwave audio track and intricate CSS-only motion.
Watermelon Themed Analog Clock
demo & codeThis Watermelon CSS Analog Clock transforms a standard timekeeping UI into a playful, summery vector illustration. By leveraging SCSS pre-processing for generative design and CSS Gradients for complex shapes, it reduces HTML markup while maintaining a vibrant, flat-design aesthetic.
Line House
A pure CSS illustration of a house constructed from geometric primitives using clip-path for complex shapes and transform for perspective. It features a warm color palette managed via CSS variables, extensive drop-shadow usage for foliage density, and linear-gradient for detailed window reflections.
See the Pen Line House.
Moiré Psy-Dance Party VIP Access Card (CSS Only)
A psychedelic 3D VIP card animation powered by pure CSS.
See the Pen Moiré Psy-Dance Party VIP Access Card (CSS Only).
Profile CSS Drawing
A stylish, detailed vector-style portrait with depth and shadows, fully implemented using pure CSS gradients and clipping paths.
See the Pen Profile CSS Drawing.
Warrior
A pure CSS illustration of a knight constructed from geometric primitives. It employs repeating-linear-gradient for shield textures, clip-path for armor shaping, and extensive box-shadow duplication to render limbs and details efficiently, creating a stark, high-contrast monochrome aesthetic.
See the Pen Warrior.
Animated Navigation
A spotlight navigation menu where the active state is highlighted by a moving “light beam” element.
See the Pen Animated Navigation.
Animated Sign-In Form with Theme Switcher
An interactive login form that performs a 360-degree 3D flip animation to seamlessly transition between vibrant, gradient-based color themes triggered by a JavaScript state manager.
See the Pen Animated Sign-In Form with Theme Switcher.
Little Details
A stylized nested to-do list employing advanced CSS pseudo-elements for custom markers and hover-based reveal logic for sub-tasks. JavaScript handles basic DOM manipulation for adding/removing items, while the dark UI features gradient borders and tooltip interactions.
See the Pen Little Details.
Ergonomic Toggle (CSS)
A hyper-realistic skeuomorphic toggle switch crafted entirely in CSS using advanced box-shadows and gradients to simulate depth and lighting.
See the Pen Ergonomic Toggle (CSS).
Holographic Name Card with Hover Effects
An interactive 3D holographic card where JavaScript maps pointer coordinates to scoped CSS Custom Properties like --pointer-x. The physical lighting simulation relies on complex gradient layering, mask-image, and mix-blend-mode, all dynamically driven by these calculated values to create realistic depth and glare.
See the Pen Holographic Name Card with Hover Effects.
Skull Toggle (CSS)
A playful skeleton toggle switch animated purely with CSS. The skull handle slides via @keyframes triggered by the :checked state, while a complex hand assembly - constructed from gradients and box-shadows - slides in to “push” the toggle, creating a whimsical, interactive narrative without JavaScript.
See the Pen Skull Toggle (CSS).
Metal/Glass Button
A high-quality simulation of a metallic surface that “plays” with light following the mouse cursor, creating a tactile sensation of premium material.
See the Pen Metal/Glass Button.
React Radio Player
A tactile, interactive player that looks and behaves like a real gadget, featuring smooth power-on animations and live audio streaming.
See the Pen React Radio Player.
List Styles
An aesthetically pleasing, modern todo list featuring a vibrant gradient theme and an intuitive hierarchy creation function without complex control buttons.
See the Pen List Styles.
Creative Section Design
A visually rich, animated section with cards that respond to hover (a colored border appears), creating a sense of interactivity and depth.
See the Pen Creative Section Design.
Simple HTML Charting with CSS Grid, Writing Mode, and Vue
A lightweight, colorful, and animated chart demonstrating data visualization capabilities using pure CSS and Vue without heavy dependencies.
Interactive Gooey Buttons
Interactive buttons featuring a fluid, mouse-tracking glow effect powered by CSS custom properties. JavaScript calculates cursor coordinates to dynamically position radial gradients and text shadows, while CSS filters create a ‘gooey’ liquid animation that responds organically to user interaction.
See the Pen Interactive Gooey Buttons.
DOM-Based Platformer with Gamepad API Support
A DOM-based platformer engine that constructs levels from numeric arrays, utilizing document.elementFromPoint for real-time collision detection and physics simulation. The JavaScript game loop manages gravity, gamepad support, and level transitions, while intricate CSS gradients and animations bring the tile-based world and character to life.
See the Pen DOM-Based Platformer with Gamepad API Support.
Pure CSS Pricing Plans with Gradient Ribbons
A pricing component where complex ribbon geometry is calculated via SCSS trigonometry and sculpted using conic-gradient alongside mask-composite. The organic, fluid connections between shapes are achieved through the filter: blur() contrast() technique, creating a scalable vector-like aesthetic entirely within CSS without relying on runtime JavaScript or external SVG assets.
See the Pen Pure CSS Pricing Plans with Gradient Ribbons.
3D Neon Toggle On/Off Switch
An advanced 3D toggle switch simulating a physical button with a neon glow. The effect is implemented in pure CSS using an <input type="checkbox">, and the state transition (ON/OFF) is achieved through a complex interplay of box-shadow and 3D transforms.
See the Pen 3D Neon Toggle On/Off Switch.
3D Toggle On/Off Switch v2
The use of gradients to create a realistic metallic effect and highlights on the button. Various types of linear-gradient and radial-gradient are applied to create a multi-layered background, and clip-path precisely clips the shapes of the pseudo-elements.
See the Pen 3D Toggle On/Off Switch v2.
CSS Day/Night Lighthouse Illustration
A purely CSS rendering of a complex lighthouse scene at sunset/night. The “checkbox hack” is used to toggle between day and night modes. All graphics - from the lighthouse itself to the sea, clouds, and stars - are created exclusively using CSS gradients and box-shadow.
See the Pen CSS Day/Night Lighthouse Illustration.
Single Div CSS Computer
A demonstration of pixel art creation using only CSS gradients and box-shadow animation, without a single image file or extra HTML elements.
See the Pen Single Div CSS Computer.
Multi-Card Spotlight Effect
An interactive 3D card effect where JavaScript tracks pointermove, calculates the relative cursor position, and passes it to --ratio-x and --ratio-y CSS variables, while CSS uses calc() to drive rotateX and rotateY.
See the Pen Multi-Card Spotlight Effect.
Animated Ratings Component
This interactive rating component stands out with three unique 3D effects, built using advanced Sass (loops, gradient randomization), - and showcases SVG facial animation via path morphing in pure JS.
See the Pen Animated Ratings Component.
React Color Gradient Palette
This React component library demonstrates a technically clean solution for displaying color gradients.
See the Pen React Color Gradient Palette.
Realistic MPK Mini MIDI Controller in Pure CSS
Pure CSS skeuomorphism in action - a complete replica of a MIDI controller where every knob, pad, and key is drawn by layering dozens of gradients and shadows.
See the Pen Realistic MPK Mini MIDI Controller in Pure CSS.
Cursor Following Halftone Rings with CSS @property
A cursor effect creating dynamic halftone rings is implemented using CSS Custom Properties and transition properties for smooth mouse-following, requiring minimal JavaScript to update coordinates.
See the Pen Cursor Following Halftone Rings with CSS @property.
Intersecting Diagonals Pattern
A pattern generated with just one background property, showcasing advanced use of CSS gradients and background-size to create a complex, repeating texture, with flexible customization via custom CSS properties.
See the Pen Intersecting Diagonals Pattern.
Lighthouse Single-Div CSS Illustration
The entire scene is constructed from a combination of gradients (linear-gradient/radial-gradient) and precise element positioning using background-position.
See the Pen Lighthouse Single-Div CSS Illustration.
Button with Animated Gradient
Achieve a premium, vibrant glow and pulsating background with this component, which utilizes high-performance CSS animations and dynamic box-shadow effects, all orchestrated by TypeScript and the GSAP library.
See the Pen Button with Animated Gradient.
Neomorphic Calendar Card Component
A neomorphic calendar card component with SCSS-driven depth and complex CSS transformations, featuring a concise vanilla JavaScript implementation to display the live UTC date and month.
See the Pen Neomorphic Calendar Card Component.
Pro-Mode Toggle Switch w/ Guard
Dual input[type="checkbox"] system for two-step activation, showcasing mastery in creating logic without JavaScript and detailed UI using a repeating-linear-gradient background and complex pseudo-elements."
See the Pen Pro-Mode Toggle Switch w/ Guard.
Color Clipping Effect with CSS Gradients and GSAP
A sleek text hover and intro animation, implemented using GSAP to smoothly transition CSS gradient stops via modern CSS variables, ensuring high performance and clean, maintainable code.
See the Pen Color Clipping Effect with CSS Gradients and GSAP.
Spotlight Cursor on Responsive Image
A unique, zero-dependency “flashlight” UI effect achieved by dynamically positioning a large, transparent-to-radial-gradient element via Vanilla JavaScript mousemove, and using the powerful CSS mix-blend-mode: exclusion to create the inverted color effect over the background image.
See the Pen Spotlight Cursor on Responsive Image.
Pure CSS Loader #10/2020 - No SVG Arcs
An elegant loader built purely with CSS/SASS that leverages CSS Houdini’s @property to define and smoothly animate custom numeric properties, enabling a high-performance rotation and hue-shifting loop.
See the Pen Pure CSS Loader #10/2020 - No SVG Arcs.
Light and Shadow Mouse Tracking
A showcase of powerful interactive styling, where JS logic calculates cursor distance and direction to control a moving shadow and the intensity of a border glow via CSS variables and pseudo-elements.
See the Pen Light and Shadow Mouse Tracking.
Responsive Banners with CSS Grid and Variables
This component leverages the power of CSS Grid for precise layout control and CSS Custom Properties to dynamically inject data like color schemes. It features decorative CSS Counters and complex background layering for a polished, modern component without relying on JavaScript for styling.
See the Pen Responsive Banners with CSS Grid and Variables.
Card with Illumination Effect
An example of how to achieve an impressive pseudo-3D interface using pseudo-elements (::before) and CSS transforms. The effect is built by layering elements (.light-layer, .darken) with different box-shadow and gradients to simulate the play of light and shadow on the surface.
See the Pen Card with Illumination Effect.