Creator

How CSS Gradients Work: Angles, Color Stops and Examples

ToolOrbit Team 2 min readUpdated
How CSS Gradients Work: Angles, Color Stops and Examples

Gradients add depth and personality to buttons, hero sections, and backgrounds, but hand-writing the CSS syntax is fiddly, especially with multiple color stops and angles. The ToolOrbit CSS Gradient Generator lets you build linear and radial gradients visually with a live preview, then copy clean, ready-to-paste code.

How CSS gradients work

A CSS gradient is an image generated by the browser from color stops. A linear gradient blends colors along a straight line defined by an angle or direction, while a radial gradient blends outward from a center point. Each color stop has a color and an optional position, giving you precise control over where one color hands off to the next.

  • linear-gradient(): blends along an angle such as 90deg or to right
  • radial-gradient(): blends outward from a center in a circle or ellipse
  • Color stops: each color plus an optional percentage position
  • Multiple stops: add three or more colors for richer transitions
.hero {
  background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
}

.badge {
  background: radial-gradient(circle, #22d3ee 0%, #0ea5e9 100%);
}

Building a CSS gradient visually

Choose linear or radial, add and recolor your stops, and drag to reposition them while the live preview updates in real time. Set the angle for linear gradients or the shape for radial ones. When the result looks right, copy the generated CSS straight into your stylesheet.

  • Pick the gradient type: linear or radial
  • Add color stops and choose each color
  • Adjust positions and the angle or center
  • Copy the generated CSS with one click
For subtle, professional results, keep your colors close in hue or lightness. High-contrast gradients can look harsh, while gentle transitions read as polished.

Tips for great gradients

Use gradients to guide the eye, such as a darker corner that draws focus to a headline. Test your gradient behind real text to confirm contrast and readability. For large backgrounds, two-stop gradients usually look cleaner than busy multi-stop ones. The ToolOrbit Gradient Generator makes it easy to experiment quickly and ship the exact look you want.

What the angle really means

to/from angle directions
Keyword or angleDirection
to top (270deg)Bottom to top, like a sunrise
to right (90deg)Left to right
to top right (45deg)Diagonal, from bottom-left
0degTop to bottom

Adding a third stop in the middle of a two-color gradient, typically a tone in between, kills the muddy band — the single most common quick fix. Keep transitions going the same direction the light falls in your design, and sample against an image behind it before committing: gradients that look smooth on white can betray banding on a photo.


Tools mentioned

More reading

View all guides
HEX vs RGB vs HSL: Which Color Format to Use
Creator

HEX vs RGB vs HSL: Which Color Format to Use

HEX, RGB and HSL describe the same colours in three ways. Here is how each one works and when each is the easier choice in CSS and design tools.

2 min readUpdated
CSS box-shadow Explained: Offset, Blur, Spread and Inset
Creator

CSS box-shadow Explained: Offset, Blur, Spread and Inset

How the CSS box-shadow property works, value by value, with tips for layered, realistic shadows.

2 min readUpdated
CSS border-radius Explained: One, Two and Four Values
Creator

CSS border-radius Explained: One, Two and Four Values

How the CSS border-radius property works and how its one-, two- and four-value shorthand maps to each corner.

2 min readUpdated
CSS Border Radius: 15 Copy-Paste Examples
Developer

CSS Border Radius: 15 Copy-Paste Examples

15 modern CSS border radius examples: rounded cards, pills, circle avatars, asymmetrical organic blobs, and fancy 8-value border radius shapes.

3 min readUpdated
What Is Base64? How Encoding Works and Common Mistakes
Developer

What Is Base64? How Encoding Works and Common Mistakes

What Base64 encoding actually does, where it is used, and the mistakes that cause broken or oversized output.

2 min readUpdated
encodeURI vs encodeURIComponent: Which One to Use
Developer

encodeURI vs encodeURIComponent: Which One to Use

How percent-encoding works, the difference between encoding a whole URL and a single component, and the mistakes that break links.

2 min readUpdated
What Is a UUID? Version 4 vs Version 7 Explained
Developer

What Is a UUID? Version 4 vs Version 7 Explained

What a UUID looks like, why version 4 is the safe default, when version 7 is better, and best practices for IDs.

2 min readUpdated
How SHA-256 and SHA-512 Hashes Work: Hashing vs Encryption
Developer

How SHA-256 and SHA-512 Hashes Work: Hashing vs Encryption

What a hash function does, how to choose between SHA-256 and SHA-512, and why hashing is not encryption.

2 min readUpdated