CSS Gradient Generator
Copy clean CSS, SCSS, Tailwind, inline style, background-image, or React style output.
Search, filter, load instantly, and favorite gradients with local storage.
Complete Guide to CSS Gradients
CSS gradients are image values generated directly by the browser. Instead of downloading a bitmap, a designer writes a function such as linear-gradient(), radial-gradient(), or conic-gradient(), and the rendering engine paints a smooth transition between color stops. That makes gradients compact, scalable, editable, and resolution independent. A gradient can fill a page background, button, card, border, icon mask, chart segment, text headline, skeleton loader, or overlay. Because it is CSS, it can respond to media queries, custom properties, themes, hover states, and animations without rebuilding an image file.
The goal of a CSS gradient generator is not merely to produce something colorful. A good generator helps you reason about direction, color contrast, transparency, browser syntax, responsive behavior, and reusable code. Gradients look simple, but production gradients often carry subtle requirements: they must remain readable behind text, load immediately, support dark and light themes, animate smoothly, and avoid visual banding on large displays. The editor above is built around those everyday decisions.
What Is a CSS Gradient?
A CSS gradient is a special kind of <image> value. You can place it anywhere CSS accepts an image, most commonly in background or background-image. Unlike a JPEG or PNG, it is described by math: a direction or shape, a set of color stops, and optional positions. The browser interpolates the colors between those stops and paints the result at any size. That is why the same declaration can look crisp on a watch, phone, laptop, or 8K screen.
Gradients can be used as the entire visual identity of a section or as a subtle utility layer. A two-color blue gradient can communicate calm and trust. A dark transparent overlay can make white text readable over a photograph. A repeating gradient can create stripes, grid lines, loading shimmer, or paper-like texture. A conic gradient can draw pie charts, color wheels, progress rings, and decorative bursts. The range is broad because the primitive is flexible.
A Brief History of Gradients on the Web
Early web gradients were usually raster images exported from design tools. Developers sliced a one-pixel strip, repeated it across a container, and hoped it would not look dated when the layout changed. Vendor-prefixed CSS gradients appeared as browsers experimented with syntax. Over time the standards settled into the modern functions used today. Linear and radial gradients became broadly reliable first, while conic gradients arrived later and unlocked angular effects that previously required SVG, canvas, or images.
Today, CSS gradients are widely supported in modern browsers. The practical challenge is no longer whether a browser can paint a gradient; it is whether the gradient is readable, maintainable, and appropriate for the interface. Production teams use gradients in design systems, brand themes, generated avatars, charts, notification states, and marketing surfaces. They also combine gradients with CSS variables so one gradient recipe can be reused across many components.
Gradient Types
Linear Gradient
A linear gradient transitions colors along a straight line. The line can be described with an angle such as 135deg or with a direction keyword such as to right. Linear gradients are excellent for buttons, hero backgrounds, banners, and subtle panel surfaces. The most common mistake is choosing an angle that fights the layout. For left-to-right interfaces, a horizontal gradient can guide the eye. For tall hero sections, a diagonal can add energy. For overlays behind text, a vertical dark-to-transparent gradient often works best.
.hero {
background: linear-gradient(135deg, #ff512f 0%, #dd2476 100%);
}
Radial Gradient
A radial gradient expands from a center point. It can be a circle or ellipse and can end at the closest side, closest corner, farthest side, or farthest corner. Radial gradients are useful for spotlight effects, glow, depth, and soft lighting. A radial highlight behind a product image can make the subject feel dimensional without adding a separate image. The center position matters: a highlight at 50% 40% can feel like overhead light, while 20% 20% can create an editorial corner glow.
.spotlight {
background: radial-gradient(circle farthest-corner at 50% 40%, #ffffff 0%, #89b4ff 45%, #102a6b 100%);
}
Conic Gradient
A conic gradient rotates colors around a center point. Rather than moving along a line or radius, color changes around an angle. Conic gradients are ideal for charts, rings, wheels, badges, loaders, and playful abstract backgrounds. They also pair well with masks. For example, a conic gradient clipped by a circular mask can become a progress ring, while the same gradient clipped by text can become a vivid headline.
.ring {
background: conic-gradient(from 45deg at 50% 50%, #00f5a0, #00d9f5, #7b61ff, #00f5a0);
}
Repeating Gradients
Repeating gradients repeat their color-stop pattern indefinitely. repeating-linear-gradient() can create stripes, ruled paper, scan lines, and grids. repeating-radial-gradient() can create ripples, targets, and texture. repeating-conic-gradient() can create checkerboards, rays, and angular patterns. Because repeating gradients can become visually intense, they usually work best at low contrast or behind a transparent overlay.
Gradient Syntax
The syntax starts with a function name, followed by optional geometry and then a comma-separated list of color stops. A color stop contains a color and, optionally, one or two positions. Positions are commonly percentages, but lengths are valid in many contexts. If you omit positions, the browser distributes stops evenly. Explicit positions give you more control and make the gradient easier to reproduce across tools.
.box {
background:
linear-gradient(
90deg,
rgba(255, 0, 120, 1) 0%,
rgba(255, 180, 0, .85) 50%,
rgba(0, 180, 255, 1) 100%
);
}
Color Stops
Color stops are the heart of a gradient. Two stops create a simple transition. Three stops can introduce a midpoint, highlight, or shadow. Four or more stops can create complex atmospheric blends. The order of stops matters, and so do their positions. When two stops share the same position, the transition becomes sharp. That technique is useful for flags, charts, stripes, and hard-edged backgrounds.
Opacity is part of the color. A stop can be fully opaque, partially transparent, or completely transparent. Transparent gradients are especially useful as overlays. For example, a card can use a transparent-to-dark gradient over an image so text remains readable at the bottom while the image is still visible at the top.
Angles and Direction
In modern CSS, 0deg points upward and angles increase clockwise. 90deg points right, 180deg points down, and 270deg points left. Direction keywords are often more readable in hand-written code: to right, to bottom, and to top left communicate layout intent. Numeric angles are better when a design requires precise visual alignment.
Transparency and Layering
Gradients become more powerful when layered. CSS allows multiple backgrounds separated by commas. The first background is painted on top. You can combine a transparent gradient with a solid color, another gradient, or an image. This makes effects such as glass panels, atmospheric overlays, and branded image treatments possible without extra markup.
.photo-card {
background:
linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,0)),
url(image.jpg) center / cover;
}
Browser Support
Linear and radial gradients are mature in modern browsers. Conic gradients are also supported by current major browsers, but older environments may need a fallback. A conservative production pattern is to set a solid background color before the gradient. If the gradient is unsupported, users still see a usable surface. If the gradient is decorative, this fallback is usually enough.
.banner {
background-color: #3563ff;
background-image: linear-gradient(135deg, #3563ff, #15b8a6);
}
Choosing Colors for Gradients
Color selection is where gradients succeed or fail. Two attractive colors do not always create an attractive transition because the browser has to interpolate between them. A vivid red and a vivid green can pass through a dull brown midpoint. A bright cyan and saturated yellow may create a harsh center that competes with text. When a gradient feels muddy, add an intentional midpoint color, reduce saturation, or choose colors that are closer together on the color wheel.
Design systems often define palettes with brand, neutral, success, warning, and danger scales. Gradients should respect those scales instead of introducing random colors. A product team might use a blue-to-teal gradient for primary actions, a gray-to-white gradient for quiet surfaces, and a red-to-orange gradient only for marketing or critical emphasis. Consistency makes gradients feel like part of a system rather than decoration pasted onto it.
Warm, Cool, and Neutral Palettes
Warm gradients use reds, oranges, yellows, pinks, and coral tones. They feel energetic, optimistic, and attention grabbing. Cool gradients use blues, greens, cyans, and violets. They often feel calm, technical, clean, or trustworthy. Neutral gradients use whites, grays, muted tans, and near-black tones. They are useful for product interfaces because they create depth without stealing focus. Many polished interfaces combine a neutral base with one small vivid accent gradient.
Working With HSL
HSL can be easier to reason about than hex when editing by hand. Hue controls the color family, saturation controls intensity, and lightness controls brightness. If you keep saturation and lightness similar while changing hue, you can create balanced transitions. If you keep hue constant and vary lightness, you can create subtle dimensional surfaces. A gradient like hsl(220 90% 56%) to hsl(190 90% 48%) often feels more coherent than two unrelated hex values chosen by eye.
Responsive Gradient Design
A gradient is painted inside a box, and that box changes across devices. A diagonal gradient on a wide desktop banner may show a long, elegant transition, while the same gradient on a narrow mobile card may show mostly one color. This is not a browser problem; it is a design reality. Check important gradients at the actual aspect ratios where they will appear. If the design depends on a highlight being near a headline or button, adjust the angle, center point, or stop positions for smaller screens.
CSS media queries can make gradients responsive. A hero might use linear-gradient(120deg,...) on desktop and linear-gradient(180deg,...) on mobile. A radial highlight might move from 70% 30% on desktop to 50% 18% on mobile so the light stays behind the subject. For reusable components, CSS custom properties make this tidy because the component can keep one background declaration while media queries update only the variables.
.hero {
--angle: 120deg;
background: linear-gradient(var(--angle), #0f62fe, #00b8d9);
}
@media (max-width: 700px) {
.hero { --angle: 180deg; }
}
Layered Gradients
Layering is one of the most practical gradient techniques. Because CSS supports multiple backgrounds, you can stack a lighting effect, a tint, a texture, and a base color in a single declaration. The first layer appears on top. A common pattern is a transparent radial highlight over a linear brand gradient. Another pattern is a dark linear overlay over a photo. The overlay improves text contrast while preserving the image.
.surface {
background:
radial-gradient(circle at 20% 10%, rgba(255,255,255,.45), transparent 28%),
linear-gradient(135deg, #1d4ed8, #14b8a6);
}
Layering can also replace extra markup. Instead of adding decorative elements to the DOM, a card can paint its own highlight and edge treatment. This keeps the HTML cleaner and reduces the chance that decorative layers will interfere with screen readers or keyboard navigation. The tradeoff is maintainability: deeply layered backgrounds can become hard to read, so format them across multiple lines and give important values names with custom properties.
Gradient Borders and Masks
CSS gradients are not limited to ordinary backgrounds. They can be used for borders by combining multiple background layers with padding-box and border-box. They can also be used with masks to create rings, fades, and cutouts. A gradient border is often more reliable than an image border because it scales with the component and can adapt to themes.
.gradient-border {
border: 1px solid transparent;
background:
linear-gradient(#ffffff, #ffffff) padding-box,
linear-gradient(135deg, #ff8a00, #e52e71) border-box;
}
Masks require more browser testing than standard backgrounds, but they unlock refined effects. A fade mask can make overflowing content disappear softly. A conic gradient mask can create a partial ring. A linear gradient mask can make a carousel edge feel less abrupt. Use these techniques where they add clarity, not just decoration.
Animated Gradients
Animated gradients can make a page feel alive, but they should be used sparingly. The most common technique is to make the background larger than the element and animate background-position. This creates motion without changing the gradient itself on every frame. Slow motion usually feels more premium than fast motion. A loop of six to twelve seconds is often enough for a hero or badge. For operational UI, consider animation only for transient states such as loading, progress, or celebration.
.animated-gradient {
background: linear-gradient(90deg, #ff4d8d, #6d5dfc, #00d4ff);
background-size: 220% 220%;
animation: gradient-shift 8s ease infinite;
}
@keyframes gradient-shift {
0%, 100% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
}
Always consider users who prefer reduced motion. CSS provides @media (prefers-reduced-motion: reduce). In that query, turn off nonessential gradient animations. This is a small addition that makes a page more comfortable for people with vestibular sensitivity and more respectful of battery life on portable devices.
Gradients in WordPress and Elementor
Elementor HTML widgets can run self-contained HTML, CSS, and JavaScript, but they live inside a larger WordPress page. That means the safest approach is scoped code. Selectors should begin from a unique widget root, scripts should initialize only elements inside that root, and JavaScript should avoid global variables. This page follows that pattern by looking for elements marked with data-cgg and creating state inside an isolated function. If the widget is pasted twice on the same page, each instance can maintain its own controls.
When using gradients in WordPress themes, remember that theme CSS may already style buttons, inputs, headings, and sections. Scoped selectors reduce conflicts. Native form elements are also helpful because they inherit accessibility behavior from the browser. Avoid relying on CDN scripts inside an HTML widget when the tool needs to work offline, during staging, or on sites with strict security policies.
Exporting Gradients
Export format depends on where the gradient will be used. Plain CSS is best for stylesheets and design systems. Inline style output is useful for quick prototypes, CMS fields, or one-off HTML. A React style object is useful when styles are passed through component props. Tailwind arbitrary values are convenient in utility-first projects, although very complex gradients can become difficult to read in class attributes. SCSS output is helpful when a team stores design tokens in variables.
For documentation, keep the readable CSS version even if your application uses another format. Future maintainers can understand a formatted declaration more easily than a minified string. If the gradient is part of a brand system, give it a semantic name such as --gradient-primary, --gradient-success-surface, or --gradient-hero-sunset. Semantic names explain intent better than names based only on colors.
Debugging Gradient Problems
If a gradient does not appear, check whether another background declaration overrides it. The shorthand background resets several background-related properties, so it can accidentally erase background-size or background-position. If a gradient appears flat, verify that the color stops are not all at the same position and that transparent stops are not placed over a background with the same color. If text gradient clipping fails, make sure both background-clip: text and -webkit-background-clip: text are present for broader compatibility.
If a gradient looks banded, try increasing the distance between similar stops, reducing contrast, adding a subtle noise overlay, or adjusting the palette. Banding is more visible on large smooth areas and low-quality displays. It can also appear after screenshots or video compression. For large hero backgrounds, a tiny amount of texture can make the transition feel smoother.
Performance
Static gradients are generally inexpensive. They avoid image downloads and scale cleanly. Animated gradients require more care. Large animated backgrounds, filters, and blend modes can increase paint work, particularly on low-power devices. Prefer slower animations, limited areas, and simple keyframes. When possible, animate background-position rather than constantly rewriting styles in JavaScript. Respect prefers-reduced-motion so motion-sensitive users are not forced into animated surfaces.
Accessibility
The most important accessibility concern is contrast. A beautiful gradient can still fail if text placed over it is hard to read. Test light and dark text across the entire gradient, not just at one point. If contrast varies too much, add an overlay, reduce saturation, use a solid text container, or choose a calmer palette. Avoid relying on color alone to communicate state. A red-to-green gradient may look clear to one user and confusing to another.
Keyboard accessibility matters in tools as well. Controls should be reachable with the keyboard, focus should be visible, and buttons should have names that describe their action. The generator above uses native controls where possible because native controls bring familiar interaction, accessibility semantics, and mobile behavior.
Best Practices
Use gradients with intention. Start with the interface goal: readability, depth, brand energy, visual hierarchy, or data expression. Limit the number of highly saturated colors in operational interfaces. Keep gradients subtle behind dense UI and reserve bold gradients for moments that benefit from emotion or emphasis. Store important gradients as CSS custom properties so they can be reused and updated consistently.
:root {
--brand-gradient: linear-gradient(135deg, #1d4ed8, #14b8a6);
}
.primary-action {
background: var(--brand-gradient);
}
Examples
Button Gradient
.button {
color: white;
border: 0;
border-radius: 8px;
background: linear-gradient(135deg, #6d5dfc, #00c2ff);
}
Text Gradient
.headline {
color: transparent;
background: linear-gradient(90deg, #ff4d8d, #6d5dfc, #00d4ff);
-webkit-background-clip: text;
background-clip: text;
}
Border Gradient
.panel {
border: 1px solid transparent;
background:
linear-gradient(#fff, #fff) padding-box,
linear-gradient(135deg, #ff8a00, #e52e71) border-box;
}
Common Mistakes
One common mistake is using too many unrelated colors. The result can look muddy between stops because the browser interpolates through intermediate hues. Another mistake is placing text over the brightest or busiest area. Designers also sometimes forget that gradients are responsive: a gradient that looks balanced in a small square may look empty in a wide hero. Test at multiple sizes.
Hard stop positions can also surprise people. If a later stop has a lower position than an earlier stop, the browser clamps it, creating abrupt transitions. This can be useful, but accidental hard edges often look like rendering bugs. Keep stop positions sorted unless you intentionally want a sharp division.
Real World Uses
Gradients appear across product interfaces and editorial sites. Dashboards use them for status cards and charts. SaaS products use them for branded actions, onboarding screens, and empty states. E-commerce sites use them behind seasonal banners. Media sites use transparent overlays on thumbnails. Developer tools use conic gradients for color pickers and performance indicators. Mobile apps use gradients for splash screens, tabs, and premium states.
Frequently Asked Questions
Can I use gradients in Elementor?
Yes. A standalone HTML widget can include scoped CSS, markup, and vanilla JavaScript. Avoid external dependencies when portability matters. Keep selectors scoped to the widget root so multiple widgets can appear on the same page without collisions.
Are CSS gradients better than images?
For scalable color transitions, yes. CSS gradients are smaller, sharper, and easier to edit. Images are still better for photographic detail, hand-painted texture, or complex art-directed compositions.
How many color stops should I use?
Two or three stops are enough for many interface gradients. Use more stops when you need a specific palette journey, atmospheric blend, rainbow, aurora, metallic effect, or chart-like segmentation.
Do gradients hurt performance?
Static gradients are usually efficient. Animated gradients, huge fixed backgrounds, filters, and complex blending can be more expensive. Test on real devices if the gradient is large, animated, or repeated many times.
How do I make gradient text accessible?
Use a large enough font size, keep the gradient high contrast, and provide a fallback color. Avoid placing gradient text over busy backgrounds. If the text is critical, test contrast carefully and consider a solid color alternative for high contrast modes.
What is the safest fallback?
Set a plain background-color before background-image. The color should match one of the gradient stops or the average tone of the design.
Workflow for Production Gradients
Start by choosing the gradient type that matches the job. Use linear gradients for directional movement, radial gradients for focus and glow, and conic gradients for circular or angular visuals. Select stops from a coherent palette. Adjust positions for balance. Check the result at mobile and desktop sizes. Add a fallback color. Copy the CSS into a custom property if the gradient will be reused. Finally, test contrast and reduced-motion behavior before shipping.
A generator speeds up experimentation, but judgment still matters. The best gradients feel integrated with the content and layout. They support the interface instead of competing with it. When used with care, CSS gradients are one of the most efficient visual tools available to front-end developers.
CSS Filters and Blend
Modes: Complete Guide
CSS Filters and Blend Modes are powerful visual effects that
allow developers to manipulate the appearance of images, backgrounds, and HTML
elements without editing the original graphics. They are widely used in modern
web design to create attractive user interfaces, interactive effects, image
enhancements, and creative visual compositions.
Using CSS filters, you can blur images, adjust brightness
and contrast, change colors, apply grayscale or sepia effects, control opacity,
and even create shadows. Blend modes allow one element to blend with the colors
of another, producing effects similar to those found in professional image
editing software like Adobe Photoshop.
What are CSS Filters?
CSS Filters are visual effects applied directly to HTML
elements using the filter property. They modify the rendering of an element
while leaving the original image or content unchanged.
Syntax
filter: filter-function(value);
You can apply multiple filters together.
filter: brightness(120%) contrast(150%) saturate(180%);
Filters are processed from left to right, so the order of
filters can affect the final result.
Supported CSS Filter
Functions
blur()
The blur() function softens an image by reducing the
sharpness of its pixels.
Syntax
filter: blur(5px);
Uses
- Background
blur
- Glassmorphism
- Loading
placeholders
- Privacy
masking
brightness()
The brightness() filter controls how light or dark an
element appears.
Syntax
filter: brightness(150%);
Values
- 100%
= Original
- Greater
than 100% = Brighter
- Less
than 100% = Darker
contrast()
The contrast() function adjusts the difference between light
and dark colors.
filter: contrast(180%);
Higher values produce more vivid images, while lower values
create a flatter appearance.
grayscale()
Converts an image into black and white.
filter: grayscale(100%);
Useful for portfolios, hover effects, galleries, and
disabled image states.
hue-rotate()
Rotates the colors around the color wheel.
filter: hue-rotate(120deg);
This creates dramatic color variations without modifying the
original image.
invert()
Inverts all colors.
filter: invert(100%);
Commonly used for:
- Dark
mode icons
- Image
inversion
- Special
visual effects
opacity()
Controls element transparency.
filter: opacity(50%);
Unlike the CSS opacity property, it can be combined with
other filters.
saturate()
Controls color intensity.
filter: saturate(180%);
Higher saturation produces vibrant colors, while lower
saturation results in muted tones.
sepia()
Applies a warm brown vintage effect.
filter: sepia(100%);
Frequently used to create antique or nostalgic photographs.
drop-shadow()
Creates realistic shadows that follow the actual shape of an
image, including transparent areas.
filter: drop-shadow(10px 10px 20px rgba(0,0,0,.4));
Unlike box-shadow, it respects transparent pixels.
url()
The url() filter references an SVG filter.
filter: url(#myFilter);
SVG filters can perform advanced effects like displacement
maps, turbulence, lighting effects, and custom color transformations.
Combining Multiple
Filters
Multiple filters can be combined into one declaration.
filter:
brightness(110%)
contrast(140%)
saturate(150%)
drop-shadow(10px 10px 20px rgba(0,0,0,.3));
The browser processes each filter sequentially.
Browser Support
All major browsers support CSS Filters.
- Google
Chrome
- Mozilla
Firefox
- Microsoft
Edge
- Safari
- Opera
Older versions of Internet Explorer do not support CSS
Filters.
What are CSS Blend
Modes?
Blend Modes determine how one element’s colors combine with
the colors beneath it.
The property used is:
mix-blend-mode
It works similarly to layer blending modes in Photoshop.
CSS Blend Mode Values
normal
Default mode. No blending occurs.
mix-blend-mode: normal;
multiply
Darkens colors by multiplying them together.
Useful for shadows and overlays.
screen
Brightens colors and produces the opposite effect of
Multiply.
Commonly used for glowing effects.
overlay
Combines Multiply and Screen.
Produces strong contrast while preserving highlights.
darken
Keeps only the darker colors.
lighten
Keeps only the lighter colors.
color-dodge
Brightens the base colors dramatically.
Creates glowing highlights.
color-burn
Darkens the base colors significantly.
Useful for dramatic effects.
hard-light
Produces intense lighting based on the top layer.
soft-light
Creates gentle lighting effects.
Popular in modern UI design.
difference
Displays the difference between colors.
Creates interesting inverted effects.
exclusion
Similar to Difference but with lower contrast.
hue
Uses the hue of the top element while preserving the
brightness of the bottom element.
saturation
Uses only the saturation values of the top element.
color
Uses both hue and saturation from the top layer while
keeping luminosity from the bottom.
luminosity
Uses brightness from the top element while preserving color
information below.
plus-darker
Creates darker blended results.
plus-lighter
Creates brighter blended results.
Filter vs Blend Mode
|
Feature |
CSS Filter |
Blend Mode |
|
Changes element itself |
✔ Yes |
✖ No |
|
Interacts with background |
✖ No |
✔ Yes |
|
Image enhancement |
✔ Yes |
Limited |
|
Color mixing |
Limited |
✔ Excellent |
|
Multiple functions |
✔ Yes |
One mode at a time |
|
Photoshop-like effects |
Partial |
✔ Yes |