CSS Introduction

CSS Tutorial What is CSS CSS Syntax CSS Selector How to include CSS CSS Comments

CSS Attributes

CSS Background CSS Border CSS Display CSS Float CSS Font CSS Color CSS Hover CSS Important CSS Line-height CSS Margin CSS Opacity CSS Filter CSS Images CSS Overflow CSS Padding CSS Position CSS Vertical align CSS White space CSS Width Word-wrap in CSS Box-shadow in CSS Text-transform in CSS CSS Outline CSS Visibility CSS Counters CSS Clear fix CSS Icons CSS Justify-content Text-decoration in CSS CSS Lists CSS nth selector CSS Sticky CSS Background-clip CSS Checkbox-style CSS Letter-spacing CSS Navigation bar CSS Overlay CSS Root CSS Specificity CSS Text-indent CSS Text-stroke CSS Zoom CSS Order CSS Descendent selector CSS Clip CSS calc() CSS Background-blend-mode CSS radio-button CSS Superscript and subscript CSS Text-effects CSS Text-align CSS Variables CSS Page-break-before CSS Page-break-inside CSS Page-break-after CSS Content property CSS Word-spacing CSS Animation CSS @keyframes rules CSS Pseudo-classes CSS Pseudo-elements CSS Radial-gradient CSS Translate CSS Gradients CSS z-index CSS Loaders CSS Units CSS Transition CSS Masking CSS Arrow CSS Pagination

Questions

What is Bootstrap CSS What is CSS used for How to center a table in CSS What is a CSS File How to center a button in CSS How to change background color in CSS How to change the font in CSS How to change font size in CSS How to resize an image in CSS How to get rid of bullet pioints in CSS Is CSS a programming language How to edit CSS in WordPress How to use google fonts in CSS How to create blinking text using CSS How to Set Space between the Flexbox Is CSS a Programming Language

Difference

Difference between HTML and CSS Grid Vs Flexbox in CSS Difference between CSS Grid and CSS Flexbox

Misc

Create a 3D text effect using HTML and CSS Hover condition for a:before and a:after in CSS Bem CSS Boder Types CSS Features of CSS Font Face CSS Image Overlay CSS B Tag CSS Carousel CSS CSS Arrow CSS Focus Flex Grow in CSS Bem CSS Features of CSS Font Face CSS Removing Underline from Link in CSS Width Property in CSS Radio Button in CSS

Radial-gradient() CSS function

Radial-gradient() CSS function

It defines a CSS in-built function, which produces a smooth transition among multiple colors. It is used to set any radial-gradient that is same as a background-image. This function can be the elliptical or circular shape.

It can save the usages of bandwidth and also helps to decrease the time of download. The color appears from an individual point; expand outwards in the radial-gradient. The radial-gradient can be depicted via its ending shape and center point and multiple stop.

Syntax:

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

Following are some arguments:

position: This argument depicts a gradient position. ‘Center’ is its default value. It is described in units (like em, px, etc.) or keywords (such as left, bottom, etc.).

shape: It can portray the gradient’s shape, which can be elliptical or circular. When its value isn’t described, then it can set to the default value that is an ellipse.

size: It represents the size of a gradient. It has some possible values which are listed below:

  • closest-side
  • closest-corner
  • farthest-side
  • farthest-corner

It has a default value, i.e., farthest-corner.

start-color, …., last-color: This argument holds the color value pursued by a stop position (optional).

Let’s understand the CSS function radial-gradient with the use of some examples.

Example:

<!DOCTYPE html>   
<html>   
<head>   
<title> CSS Gradients </title>   
<style>    
#main
{ 
background-image: radial-gradient(black, lime, blue, orange); 
} 
.hello
{   
text-align:center;   
font-size:40px; 
color:white; 
font-weight:bold;   
padding:100px;   
}   
</style>   
</head>   
<body>   
<div id="main">   
<div class = "hello"> Hello World </div>     
</div>   
</body>   
</html>  

Output:

Radial-gradient() CSS function

Consider the below examples:

Example:1

In the following illustration, we will set the radial-gradient’s shape.

<!DOCTYPE html>   
<html>   
<head>   
<title> CSS Gradients </title>   
<style>    
#main
{ 
height: 400px;   
width: 600px;   
background-image: radial-gradient(circle, black, yellow, blue, red, purple, green, orange); 
} 
.hello
{   
text-align:center;   
font-size:40px; 
color:white; 
font-weight:bold;   
padding:130px;   
}
.div2
{
font-size: 35px;
color: white;
text-align: center;
}  
</style>   
</head>   
<body>   
<div id="main">   
<div class = "hello"> Hello World!! </div> 
<div class = "div2"> Welcome to the Tutorial and Example. </div>       
</div>   
</body>   
</html>  

Output:

Radial-gradient() CSS function

Example:2

In the following illustration, we will set the radial-gradient’s size.

<!DOCTYPE html>   
<html>   
<head>   
<title>CSS Gradients</title>   
<style>
.demo div
{ 
float: left; 
} 
.demo1 div
{ 
float: left; 
} 
#main1
{   
height: 400px;   
width: 600px;   
background-image: radial-gradient(farthest-side at left bottom, blue, lime, green);   
margin:20px; 
} 
#main2
{   
height: 400px;   
width: 600px; 
background-image: radial-gradient(farthest-corner at right bottom , orange, tomato, red);   
margin:20px; 
} 
#main3
{   
height: 400px;   
width: 600px;   
background-image: radial-gradient(closest-side , lightblue, blue, navy);         
margin:20px; 
}   
#main4
{   
height: 400px;   
width: 600px;   
background-image: radial-gradient(closest-corner , yellow, orange, red);   
margin:20px; 
}   
.size
{   
text-align:center;   
font-size:40px; 
color:black; 
font-weight:bold;   
padding-top :130px;   
}   
</style>   
</head>   
<body>   
<div class="demo"> 
<div id="main1">   
<div class = "size">farthest-side at left bottom</div>     
</div>   
<div id="main2">   
<div class = "size">farthest-corner at right bottom</div>     
</div>  
</div>         
<div class="demo1">        
<div id="main3">   
<div class = "size">closest-side</div>     
</div>   
<div id="main4">   
<div class = "size">closest-corner</div>     
</div> 
</div> 
</body>   
</html> 

Output:

Radial-gradient() CSS function