Computer >> Computer tutorials >  >> Programming >> CSS

Creating CSS3 Radial Gradients


For Radial Gradients, set color stops. The default shape is Ellipse, but you can also set other shapes like circle. Set at least two color stops for Radial Gradients in CSS.

Following is the code for creating radial gradients using CSS −

Example

<!DOCTYPE html>
<html>
<head>
<style>
body {
   font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
#radial {
   height: 200px;
   width: 200px;
   background-image: radial-gradient(
      rgb(255, 0, 106),
      rgb(2, 0, 128),
      rgb(0, 255, 42)
   );
}
</style>
</head>
<body>
<h1>Radial Gradient Example</h1>
<div id="radial"></div>
</body>
</html>

Output

The above code will produce the following output −

Creating CSS3 Radial Gradients