- Home
- Tools
- Color & Design
- CSS Gradient Generator
- Radial Gradient Generator
Radial Gradient Generator
Choose a circle or an ellipse, place its center and set the colors of a CSS radial gradient, then copy the radial-gradient() code.
Drag a handle to move a stop. Click the bar to add one.
Presets
How radial-gradient() is written
This is the gradient the page opens with. Its code is read from left to right:
background: radial-gradient(circle at 30% 30%, #ffffff, #7c3aed);| In the code | What it does |
|---|---|
circle | The shape. A circle stays round whatever the box looks like. The other shape, ellipse, is what you get when nothing is written: it is stretched to the proportions of the box. |
at 30% 30% | The center: 30% from the left edge and 30% from the top. Without it the gradient starts in the middle of the box. |
#ffffff | The color in the center, at 0%. |
#7c3aed | The color at 100%. Unless a size is given, that is the corner farthest from the center, here the bottom right one. |
A size can be written after the shape, by hand. closest-side ends the gradient at the nearest edge, farthest-side at the farthest edge, closest-corner at the nearest corner, and farthest-corner is what you get without one. A circle also takes a length, as in circle 120px at 30% 30%.
The last color only shows in a corner
Because 100% lies in the farthest corner, most of what you see is the first part of the gradient. With the center in the middle and the ellipse shape, the middle of every edge shows the color at 71% of the way (1 ÷ √2), whatever the size of the box.
With circle the nearer edges see even less. In a box of 300 by 200 pixels the corner is 180 pixels from the center, so the top and bottom edges, 100 pixels away, show the color at 55%.
If the outer color has to reach the edges, move its stop inwards, to 71% for the ellipse, or add closest-side after the shape by hand.
Color stops, hard edges for stripes and fading to transparent work the same in every kind of gradient. They are explained on the CSS gradient generator page.