CSS gradients explained

CSS gradients explained | Oh Juicy

CSS guide

CSS gradients explained

A simple visual explanation of CSS gradients, with tips for using them in fresh website backgrounds and design details.

Oh Juicy guideWeb designUpdated 2026

Quick answer

CSS gradients are background images created with code. The most common types are linear gradients, which move in a direction, and radial gradients, which spread from a point. Gradients can create soft backgrounds, buttons, cards, overlays and visual depth without using image files.

What is a CSS gradient?

A CSS gradient is a smooth transition between two or more colors. Because it is written in CSS, it scales beautifully, loads quickly and can be changed without opening design software.

For web design, gradients are useful when you want atmosphere without heavy imagery. They can make a page feel warmer, softer, more dynamic or more dimensional. A good gradient is not just decorative syrup. It supports the content and keeps the text readable.

Linear gradients

A linear gradient moves along a straight line: left to right, top to bottom, diagonally or at a custom angle.

background: linear-gradient(120deg, #b8eee7 0%, #f5c8dc 52%, #ff6bad 100%);

This kind of gradient is perfect for hero sections, page backgrounds and large soft transitions. Use angles like 120deg or 135deg when you want a more dynamic diagonal flow.

Radial gradients

A radial gradient spreads from a center point outward. It can create a glow, spotlight or soft cloud of color.

background: radial-gradient(circle at 30% 20%, #ffffff 0%, #f5c8dc 35%, #ff6bad 100%);

Radial gradients work well behind buttons, product cards, illustrations or sections that need a gentle visual focus.

Layered gradients

You can stack gradients like transparent sheets. This is where gradients become interesting: a glow here, a soft wash there, and suddenly the page has depth without shouting.

background: radial-gradient(circle at 20% 10%, rgba(255,255,255,.75), transparent 32%), linear-gradient(135deg, #a6e7ff 0%, #cdb9ff 42%, #ff70b8 76%, #ffd56b 100%);

Layered gradients are useful for modern landing pages, tool websites and expressive brand backgrounds.

How to make gradients readable

Keep text on calm zones

Place text over the quietest part of the gradient, not over the most dramatic color collision.

Add contrast

Use dark text on light gradients or light text on dark gradients. Check buttons and links too.

Limit color stops

Two to four colors are usually enough. Too many color stops can become digital fruit salad.

Use soft neutrals

Soft whites, creams and translucent cards help content stay readable on expressive backgrounds.

Gradient ideas for web design

  1. Hero background: use a large soft gradient behind the main heading.
  2. Card highlight: add a small radial glow behind an icon or feature.
  3. Button background: use a subtle linear gradient for a more tactile call to action.
  4. Image overlay: layer a transparent gradient over a photo to improve text contrast.
  5. Section transition: use a gradient to separate one content block from another.

Use the tool

Generate CSS gradients faster

Use a gradient generator to experiment visually, then copy the CSS into your website. The trick is not to make the wildest gradient. The trick is to make one your text can survive.

Open gradient tool →

Frequently asked questions

What is a CSS gradient used for?

CSS gradients are used for backgrounds, buttons, cards, overlays and decorative sections. They add atmosphere without image files.

What is the difference between linear and radial gradients?

A linear gradient moves in a straight direction. A radial gradient spreads outward from a point.

Are CSS gradients good for performance?

Yes, they are usually lightweight because they are generated by code rather than loaded as image files.

author avatar
Frannie-Juice-Oh