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
6
votes
4 answers

android create pie dount with gradient

Is there any way to create circle with gradient like this ? As far as i get is this:
and_dev
  • 1,483
  • 3
  • 14
  • 17
6
votes
1 answer

CSS3 gradients as SVG

On my page i'm using a lot of CSS3 gradients. I would like to provide some SVG fallback for IE and Opera. Creating SVG fallbacks for CSS3 linear-gradient is pretty easy. I use the following code:
5
votes
1 answer

(radial) gradient fill using OpenGL ES

I am currently drawing a shape using the following code; GLfloat vertex = // vertex points glLineWidth(2); glEnableClientState(GL_VERTEX_ARRAY); glColor4f(1.0, 0.0, 0.0, 1.0); glVertexPointer(2, GL_FLOAT, 0, vertex); glDrawArrays(GL_LINE_STRIP, 0,…
Thizzer
  • 16,153
  • 28
  • 98
  • 139
5
votes
1 answer

Flutter - Implementing CSS radial gradients

I am new to Flutter. Working on a background in an app but not able to emulate the exact CSS Radial gradient. This is what I intend to replicate: background-image: radial-gradient( circle farthest-corner at 10% 20%, rgba(3,235,255,1) 0%,…
ishon19
  • 327
  • 4
  • 14
5
votes
2 answers

How to create a transparent radial gradient with python?

I am trying to create a radial gradient that fades to the clear background. My goal is to create this gradient and paste it as the background to another image. So far, i have been able to create a circular gradient, but it i not transparent. i…
5
votes
2 answers

svg - how to draw ellipse gradient?

I read SVG docs but I can't find solution to this. How to draw in SVG ellipse gradient like in picture below? I use svg radialGradient but it renders circle which is not I want. So next I draw ellipse and fill it with radialGradient and I end up…
miuosh
  • 836
  • 3
  • 12
  • 35
5
votes
2 answers

RadialGradientBrush on Rounded-Corner Rectangle

I have a Rectangle with rounded corners (but not an ellipse), something like this:
melculetz
  • 1,961
  • 8
  • 38
  • 51
5
votes
1 answer

Why does a border that has opacity make a square inside a circle when I use radial-gradient(circle at)?

When I have a circle in css with background: radial-gradient(circle at 75px 50px, #5cabff, #003) and add a border that has an opacity, it makes the circle look like it has a square inside it. Why is this happening and is there a solution for this to…
Eli
  • 53
  • 4
5
votes
1 answer

React Native: Radial Gradient Background

Is there an package, or another way to have a simple, let's say blue to blueish, radial gradient background, for one of the views? I've tried react-native-radial-gradient, but it seems like it's outdated.
Milos
  • 981
  • 3
  • 16
  • 41
5
votes
1 answer

Chrome leaves white space/gap in between when rendering multiple gradients

I'm reading book "CSS Secrets" from Lea Verou. There is example with radial multiple gradients for round corners: http://dabblet.com/gist/24484257bc6cf7076a8e IE11, Edge and FF display it correctly as it was intended. But Chrome create strange…
5
votes
5 answers

Creating a fixed 5 circle rating using CSS/HTML

I'm trying to make a 5 circle rating system using CSS and HTML only (see below image for what I'd like it to look like), but I'm not sure how to achieve this. My initial idea was to make 5 circles and then somehow use them as a mask for a…
Mo Martin
  • 207
  • 3
  • 12
5
votes
1 answer

CSS3 radial gradient appears as line

I've been trying to create a radial background, except for some reason all I can get is a line. I have no idea what I'm doing wrong, any ideas? Jsfiddle: http://jsfiddle.net/3QSFj/1/ CSS: background: -webkit-gradient(radial, circle, 0, circle, 70,…
Andrew
  • 3,501
  • 8
  • 35
  • 54
4
votes
2 answers

Gradient in Internet Explorer 9 overflows the rounded border

I'm having a problem with rounded borders and a gradient in IE9. The gradient overflows the rounded border. .cn_item:hover, .selected{ width:300px; border:1px solid #333333; cursor:pointer; position:relative; overflow:hidden; …
macieira
  • 315
  • 2
  • 7
  • 18
4
votes
3 answers

CALayer and CGGradientRef anti-aliasing?

I'm having an odd issue with CALayer drawing for the iPhone. I have a root layer which adds a bunch of sublayers representing "bubbles". The end result is supposed to look something like this: http://www.expensivedna.com/IMG_0018.PNG…
4
votes
0 answers

RequireNativeComponent: "SRSRadialGradient" was not found in the UIManager

I'm trying to use the react-native-radial-gradient package in expo. Is there some other preparation I need before I can use it, or is it just not compatible?
1 2
3
23 24