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
-1
votes
2 answers

Css radial gradient, new syntax

I had a perfectly valid (judging by the look) radial gradient : .square { background-color: #f0d9b5; color: #b58863; width: 80px; height: 80px; float: left; position: relative; } .grad:after { content: ''; …
Salvador Dali
  • 214,103
  • 147
  • 703
  • 753
-2
votes
1 answer

How to gradient an image from bottom to top with css?

I'm looking for a way to gradient images from the bottom to top initial vs goal Images run in slick slider. I've already tried with radiant gradient but without any useful results.
Pio
  • 11
  • 1
  • 1
-2
votes
1 answer

radial gradient color effect on concentric circles

How to apply gradient colors on 5 concentric circles using html5 canvas gradient = context.createRadialGradient(startx, starty,radAvg, xEnd, yEnd,radAvg); gradient.addColorStop(0, startColor); gradient.addColorStop(1.0,…
Shalini
  • 219
  • 1
  • 5
  • 16
-3
votes
1 answer

How can I create this background as a CSS3 radial gradient

I want to create the radial background effect shown in the image below as a CSS3 radial gradient. The trouble is that I only really discovered radial gradients a few minutes ago and my understanding of how they work is poor. My best effort thus…
DroidOS
  • 8,530
  • 16
  • 99
  • 171
-3
votes
1 answer

SVG Circle color with gradient

I want to use svg to draw circle color like image below. I tried many ways but not have perfect result. Anybody have solution. Should I use javascript library like d3js Thank you Circle color
-3
votes
1 answer

How to add gradients to text using JavaScript

Currently I'm working on a little project and want to know how to add gradient to text using JavaScript like in CSS.
-3
votes
1 answer

Radial gradient in CSS

Can somebody tell me how I configure radial gradient in CSS to exactly look like the following background.