|
The Coordinates of the Center of a Radial Gradient
Instead of a one-directional location of the center, you can
specify the center using X and Y coordinates. To do this, after the at keyword,
provide two values separated by an empty space. The values can be provided as
HTML-based numbers. Here is an example:
background-image: radial-gradient(at 80pt 80pt, #000, White)
If you want or need, you can specify the shape of the radial
gradient. Here is an example:
<html>
<head>
<title>Exercise</title>
<style>
#whole { background: radial-gradient(circle at 80pt 80pt, #000, White); }
</style>
</head>
<body id="whole">
</body>
</html>
This would produce:

Here is the result from Firefox:

Instead of constant values, the coordinates can be provided
as percentage values.
The Center by a Relative Side
Instead of a fixed value, you can indicate that the center
would be positioned relative to a side or corner. This factor is specified by
the first argument. The available options are closest-side, farthest-side, closest-corner, or farthest-corner. Here
is an example:
background-image: radial-gradient(closest-side, Indigo, LavenderBlush)
If you want or need, you can indicate the shape by preceding
the position with it. Here is an example:
<html>
<head>
<title>Exercise</title>
<style>
#whole
{
background: radial-gradient(circle closest-side, Indigo, LavenderBlush);
}
</style>
</head>
<body id="whole">
</body>
</html>
This would produce:

Here is the result from Firefox:

The Ratio of Intensity of a Radial Gradient
As done for linear gradients, you can specify how much space
a gradient color would cover. This is provided as a percentage value after the
color. Here is an example:
background: radial-gradient(farthest-corner, Crimson 20%, Gold 65%)
If you want or need, you can specify the shape from the
center. Here is an example:
<html>
<head>
<title>Exercise</title>
<style>
#whole
{
background: radial-gradient(circle farthest-corner, Crimson 20%, Gold 65%);
}
</style>
</head>
<body id="whole">
</body>
</html>
This would produce:

Here is the result in Firefox:

The Repeating Radial Gradient
You can create a radial gradient that repeats itself. This
is done using a function named repeating-radial-gradient. Here is an example:
<html>
<head>
<title>Exercise</title>
<style>
#whole { background: repeating-radial-gradient(circle farthest-corner, Crimson 20%, Gold 25%); }
</style>
</head>
<body id="whole">
</body>
</html>
This would produce:

Here is the result from Firefox:

|