🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to CSS Notes
Topic #125

Radial Gradients


CSS radial-gradient() Function

The CSS radial-gradient() function creates a radial gradient.

A radial gradient defines a color transition that goes out from a central point.

A radial gradient requires at least two color stops. Color stops are the colors you want to render smooth transitions among.

Syntax

background-image: radial-gradient(shape size at position, start-color, ..., last-color);

By default, shape is ellipse, size is farthest-corner, and position is center.

Radial Gradient - Evenly Spaced Color Stops (this is default)

The following example shows a radial gradient with evenly spaced color stops:

Example

    #grad {
  background-image: radial-gradient(red, yellow, green);
}

Radial Gradient - Differently Spaced Color Stops

The following example shows a radial gradient with differently spaced color stops:

Example

    #grad {
  background-image: radial-gradient(red 5%, yellow 15%, green 60%);
}

Radial Gradient - Set Shape

The shape parameter defines the shape of the gradient. It can take one of the following values:

  • ellipse (this is default)
  • circle

The following example shows a radial gradient with the shape of a circle:

Example

    #grad {
  background-image: radial-gradient(circle, red, yellow, green);

}

Radial Gradient - The size Parameter

The size parameter defines the size of the gradient'ending shape. It can take one of the following values:

  • closest-side
  • farthest-side
  • closest-corner
  • farthest-corner (this is default)

Example

    #grad1 {
  background-image: radial-gradient(closest-side at 70% 60%, red, yellow,
black);
}

#grad2 {

      background-image: radial-gradient(farthest-side at 70% 60%, red, yellow, black);
}

CSS repeating-radial-gradient() Function

The CSS repeating-radial-gradient() function is used to repeat radial gradients:

Example

    #grad {
  background-image:
repeating-radial-gradient(red, yellow 10%, green 15%);
}

Want to go beyond the notes?

Join CodingNow 2.0's CSS course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Radial Gradients – FAQs

Quick answers about learning Radial Gradients in CSS.

This free note from CodingNow 2.0 explains Radial Gradients in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on CodingNow 2.0, including Radial Gradients, is 100% free with no signup required.
With focused practice, most students grasp Radial Gradients in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now