Questions tagged [radial-gradients]

A linear interpolation between two or more colors based on the distance from the center of a circle or ellipse. In radial gradients, the colors emerge from a single point and smoothly spread outward in a circular or elliptical shape unlike in linear gradients where it is from one end to another. Use this tag for any question pertaining to creation or usage of radial gradients.

Radial gradients are a linear interpolation between two or more colors based on the distance from the center of a circle or ellipse.

In radial gradients, the colors emerge from a single point and smoothly spread outward in a circular or elliptical shape unlike in linear gradients where it is from one end to another.

Radial Gradients in CSS

In CSS, a radial gradient can be created using the below syntax: (Source - W3C)

radial-gradient() = radial-gradient(
  [ [ circle               || <length> ]                          [ at <position> ]? , |
    [ ellipse              || [ <length> | <percentage> ]{2} ]    [ at <position> ]? , |
    [ [ circle | ellipse ] || <extent-keyword> ]                  [ at <position> ]? , |
    at <position> ,
  ]?
  <color-stop> [ , <color-stop> ]+
)
<extent-keyword> = closest-corner | closest-side | farthest-corner | farthest-side

Here is a sample rainbow generated using radial gradients:

.rainbow {
  height: 25vw;
  width: 50vw;
  background: -webkit-radial-gradient(50% 110%, ellipse, white 35%, violet 35%, violet 40%, indigo 40%, indigo 45%, blue 45%, blue 50%, green 50%, green 55%, yellow 55%, yellow 60%, orange 60%, orange 65%, red 65%, red 70%, white 70%);
  background: -moz-radial-gradient(50% 110%, ellipse, white 35%, violet 35%, violet 40%, indigo 40%, indigo 45%, blue 45%, blue 50%, green 50%, green 55%, yellow 55%, yellow 60%, orange 60%, orange 65%, red 65%, red 70%, white 70%);
  background: radial-gradient(ellipse at 50% 110%, white 35%, violet 35%, violet 40%, indigo 40%, indigo 45%, blue 45%, blue 50%, green 50%, green 55%, yellow 55%, yellow 60%, orange 60%, orange 65%, red 65%, red 70%, white 70%);
}

enter image description here

Useful Links/References:

353 questions
172
votes
9 answers

Make fill entire screen?

I'm using a radial gradient as the background on my webpage, like so: background-image: -webkit-gradient(radial, 100% 100%, 10, 90% 90%, 600, from(#ccc), to(#000)); It works, but when the content does not fill the whole page the gradient is cut…
Ry-
  • 218,210
  • 55
  • 464
  • 476
35
votes
7 answers

Dotted text in css?

Is it possible to make dotted text with css? I know that the obvious thing would be to use a dotted font, but If I only need to use dotted text sparingly, then having the user to download a whole font might be overdoing it. The idea that I had was…
Danield
  • 121,619
  • 37
  • 226
  • 255
35
votes
5 answers

Gradient Radius as percentage of screen size

I'm trying to create a shape drawable with radial gradient background, with radius that will adjust to the screen size (take a look at the relevant documentation). This is my code:
shaylh
  • 1,871
  • 3
  • 17
  • 19
24
votes
3 answers

How to animate a radial-gradient using CSS?

I am trying to create a radial-gradient shine affect to a div box and I am unsure whats the best way of doing so. I Have found no resources of achieving what I want to achieve; just shine affects which look like overlay. Most of the examples I have…
Lv007
  • 537
  • 1
  • 5
  • 22
20
votes
2 answers

Making a dotted grid with CSS

I want the whole body to have a dotted grid body { background-image: radial-gradient(black 1px, transparent 0); background-size: 40px 40px; } The problem is that I want to shift it so that a dot is placed at the point (0, 0), i.e. the…
Eugene Barsky
  • 5,780
  • 3
  • 17
  • 40
19
votes
4 answers

how to make a css gradient stop after so many pixels?

-moz-radial-gradient(center -200px , ellipse farthest-corner, #323C49 0%, #718299 65%) no-repeat scroll 0 0 transparent; I have this code above and i just realized that this gradient goes from top to bottom. Is there any way to make it stop the…
chasethesunnn
  • 2,149
  • 5
  • 25
  • 42
16
votes
4 answers

CSS3 Gradients to reproduce an 'inner glow' effect from Illustrator with border-radius applied

I am in the process of trying to get my head properly around CSS3 Gradients (specifically radial ones) and in doing so I think I've set myself a relatively tough challenge. In Adobe Illustrator I have created the following 'button' style. To create…
RichardTape
  • 20,865
  • 5
  • 24
  • 29
15
votes
5 answers

How do I add a radial gradient to a UIView?

I have a UIView which I want to have a radial gradient, and I'm wondering how to go about doing this?
Andrew
  • 15,935
  • 28
  • 121
  • 203
15
votes
2 answers

CSS3 Radial Gradients with RGBA()

I am working on a website which uses multiple css3 gradients as overlay for a background tiled with texture image site url: --snipped-- currently for header i am using following css: #header { background: #DBD6D3; height: 364px; background:…
Tarun
  • 5,374
  • 4
  • 22
  • 32
15
votes
1 answer

Changing the center point of a radial gradient in CSS

I need to make multiple gradients like below: Now see how the center of the grey/white gradient differs, in some cases it come from the center, for some from the left-center, for some from the center-bottom. I used THIS, tool to generate the below…
Alexander Solonik
  • 9,838
  • 18
  • 76
  • 174
13
votes
4 answers

How to make a conical gradient in iOS using Core Graphics / Quartz 2D?

How can I draw such a conical gradient in iOS using Core Graphics / Quartz 2D API? (source: ods.com.ua)
Benji Mizrahi
  • 2,154
  • 2
  • 23
  • 38
11
votes
4 answers

How to apply multiple css radial gradients to a single element

I have the following style applied to my div element: background-image: -moz-radial-gradient(50% -10%, ellipse closest-corner, rgba(5, 5, 5, 0.7), rgba(0, 0, 0, 0) 100%); This has the desired effect (being an inner drop shadow only at the top of…
hofnarwillie
  • 3,563
  • 10
  • 49
  • 73
10
votes
3 answers

Pure CSS gradient circle border

I have this UI requirement At the moment, I have a working solution of a div (with a fixed height and width and a background image for the outer gradient border) and a pseudo element, positioned absolute with a background image of the inner…
user1275105
  • 2,643
  • 5
  • 31
  • 45
9
votes
2 answers

Is there a way to draw a CGContextDrawRadialGradient as an oval instead of a perfect circle?

I need a radial gradient in the shape of an oval or ellipse and it seems like it CGContextDrawRadialGradient can only draw a perfect circle. I've been drawing to a square context then copying/drawing into a rectangular context. Any better way to do…
Ray
  • 109
  • 1
  • 3
8
votes
3 answers

How to draw an effect (Gloss with metallic lustre) on concentric circle such as following?

I referred to following article. What I actually need to draw is concentric/ Concrete circles with an effect as shown in image below. I am finding it difficult to a) Draw the white streaks radially b) Find some key terms to search for related…
Rahul Sharma
  • 3,013
  • 1
  • 20
  • 47
1
2 3
23 24