CSS Background Gradient Generator

Free CSS Background Tool

CSS Background Gradient Generator

Create linear and radial CSS background gradients visually. Adjust color stops, opacity and angle, preview the result and copy clean CSS code for sections, buttons, cards and full-page backgrounds.

1
2
3
deg

Generated CSS Code

How to Use the CSS Background Gradient Generator

  1. Choose a linear or radial gradient.
  2. Drag the color stops to change their positions.
  3. Select a color and opacity for each gradient stop.
  4. Adjust the angle when using a linear gradient.
  5. Preview the background gradient in real time.
  6. Copy the generated CSS code.
  7. Apply the gradient to a section, card, button or page background.

What Is This CSS Background Gradient Generator?

This CSS Background Gradient Generator is a free visual tool for creating smooth color transitions with pure CSS. You can build linear and radial gradients, control individual color stops, adjust opacity and change the gradient direction.

CSS gradients are scalable, lightweight and do not require image files. They can be used for hero sections, cards, buttons, banners, overlays, full-page backgrounds and decorative UI elements.

CSS Background Gradient Examples

Hero Section Gradient

A diagonal gradient can create a strong visual background for a landing page hero while keeping text and buttons readable.

Gradient Button

Two or more related colors can make a call-to-action button feel more prominent than a flat background color.

Soft Card Gradient

Subtle color differences can add depth to cards and panels without making the interface feel overly decorative.

Radial Spotlight Background

A radial gradient can simulate light spreading from one point and create a spotlight effect behind content.

Gradient Image Overlay

A semi-transparent gradient placed over an image can improve text readability and create a stronger visual hierarchy.

CSS Background Gradient Guide

What Is a CSS Gradient?

A CSS gradient is a generated background image made from smooth transitions between two or more colors. It can be used anywhere a CSS background image is supported.

.element {


background: linear-gradient(90deg, #2563eb, #7c3aed);
}

Linear Gradients

A linear gradient transitions colors along a straight line. The direction can be defined with an angle or a keyword.

.horizontal-gradient {


background: linear-gradient(
90deg,
#2563eb,
#7c3aed
);
}

Gradient Directions

CSS supports directional keywords such as to right, to bottom and to bottom right.

.gradient-right {


background: linear-gradient(
to right,
#0ea5e9,
#2563eb
);
}

.gradient-diagonal {
background: linear-gradient(
to bottom right,
#f97316,
#db2777
);
}

Gradient Angles

Angles provide more precise control over gradient direction. A value of 0deg points upward, while 90deg moves from left to right.

.angled-gradient {


background: linear-gradient(
135deg,
#06b6d4,
#8b5cf6
);
}

Multiple Color Stops

Gradients can contain more than two colors. Each color stop can also have a percentage that controls where it appears.

.multi-color-gradient {


background: linear-gradient(
90deg,
#2563eb 0%,
#7c3aed 50%,
#db2777 100%
);
}

Hard Color Stops

Two colors can share the same stop position to create a sharp transition instead of a smooth blend.

.split-background {


background: linear-gradient(
90deg,
#2563eb 0%,
#2563eb 50%,
#f8fafc 50%,
#f8fafc 100%
);
}

Radial Gradients

A radial gradient begins at a central point and expands outward in a circular or elliptical shape.

.radial-background {


background: radial-gradient(
circle at center,
#ffffff,
#60a5fa,
#1d4ed8
);
}

Moving the Radial Gradient Center

The at keyword controls where the radial gradient begins.

.top-left-glow {


background: radial-gradient(
circle at top left,
#fef3c7,
#f97316,
#7c2d12
);
}

Circle vs Ellipse

Radial gradients can use a circular or elliptical shape. Ellipse is the default and adapts to the aspect ratio of the element.

.circle-gradient {


background: radial-gradient(
circle,
#ffffff,
#2563eb
);
}

.ellipse-gradient {
background: radial-gradient(
ellipse,
#ffffff,
#7c3aed
);
}

Transparent Gradient Colors

RGBA and modern color syntax can create gradients that fade into transparency.

.transparent-gradient {


background: linear-gradient(
180deg,
rgba(15, 23, 42, 0),
rgba(15, 23, 42, .85)
);
}

Gradient Overlay on an Image

Multiple backgrounds can place a transparent gradient over an image. The first background layer is drawn above the second one.

.image-overlay {


background:
linear-gradient(
180deg,
rgba(15, 23, 42, .1),
rgba(15, 23, 42, .85)
),
url("image.jpg") center / cover no-repeat;
}

Layering Multiple Gradients

Several gradients can be layered by separating them with commas.

.layered-gradients {


background:
radial-gradient(
circle at top left,
rgba(255, 255, 255, .55),
transparent 45%
),
linear-gradient(
135deg,
#2563eb,
#7c3aed
);
}

Repeating Linear Gradients

Repeating gradients create stripes and geometric background patterns.

.striped-background {


background: repeating-linear-gradient(
45deg,
#2563eb 0,
#2563eb 12px,
#1d4ed8 12px,
#1d4ed8 24px
);
}

Conic Gradients

A conic gradient rotates colors around a center point. Although this generator currently focuses on linear and radial gradients, conic gradients are useful for color wheels, charts and decorative effects.

.conic-background {


background: conic-gradient(
from 0deg,
#ef4444,
#facc15,
#22c55e,
#3b82f6,
#a855f7,
#ef4444
);
}

Gradient Buttons

.gradient-button {


padding: .9rem 1.5rem;
border: none;
border-radius: .75rem;
background: linear-gradient(
90deg,
#2563eb,
#7c3aed
);
color: #ffffff;
font-weight: 700;
cursor: pointer;
}

Gradient Cards

.gradient-card {


padding: 2rem;
border: 1px solid rgba(255, 255, 255, .5);
border-radius: 1.25rem;
background: linear-gradient(
135deg,
#eff6ff,
#f5f3ff
);
}

Animated Background Gradient

A gradient can be animated by increasing its background size and changing the background position.

.animated-gradient {


background: linear-gradient(
90deg,
#2563eb,
#7c3aed,
#db2777,
#2563eb
);
background-size: 300% 100%;
animation: gradient-move 8s linear infinite;
}

@keyframes gradient-move {
from {
background-position: 0 50%;
}

to {
background-position: 100% 50%;
}
}

Accessibility and Contrast

Text placed over a gradient must remain readable across every color in the background. Test the lightest and darkest sections of the gradient, not only its average appearance.

Performance Considerations

Static CSS gradients are lightweight and scale without image files. Large animated gradients can increase rendering work, especially when applied to full-screen elements.

Best Practices

  • Use two or three related colors for clean professional gradients.
  • Use explicit color stops when exact placement matters.
  • Test text contrast across the full gradient.
  • Use transparent gradients for image overlays.
  • Use subtle gradients for cards and content-heavy interfaces.
  • Avoid highly saturated gradients behind long paragraphs.
  • Use animated gradients sparingly.
  • Respect reduced-motion preferences when adding animation.

CSS Background Gradient Generator FAQ

What is a CSS background gradient?

A CSS background gradient is a generated image that creates a smooth transition between two or more colors.

What is the difference between linear and radial gradients?

Linear gradients move colors along a straight line, while radial gradients expand colors outward from a central point.

How do I change the direction of a linear gradient?

Use a directional keyword such as to right or an angle such as 135deg.

Can a gradient contain more than two colors?

Yes. You can add any number of color stops and assign a position to each one.

Can CSS gradients use transparent colors?

Yes. Use RGBA, HSLA or modern color syntax with alpha values to create transparent gradient stops.

Can I place a gradient over a background image?

Yes. Separate multiple background layers with commas and place the gradient before the image.

Can CSS gradients be animated?

Yes. Gradient movement can be simulated by animating background size, background position or CSS custom properties.

Do CSS gradients work in modern browsers?

Yes. Linear, radial and conic gradients are supported by current major browsers.

Last update: 15. 07. 2026.