Course Technology Cengage Learning New Perspectives on HTML and CSS
Tutorial 8

Radial Gradients

This demo shows how to create a background gradient using the CSS3 radial-gradient() function. The syntax of the function is:

radial-gradient(center, shape size, color-stop, color-stop ...)

where center is the position of the radial gradient's center, shape is the shape of the gradient (circle or ellipse), size is the size of the gradient from the center point, and color-stop are the colors and positions of each color in the gradient. If no position is specified, the colors are even distributed across the object background.

To use the demo, enter the starting position or the angle of the gradient and specify the RGB color value and position of each color. Press the Tab key to display the change. Positions can be expressed in pixels or percentages. If you omit the center position, the radial gradient will be placed at the horizontal and vertical center of the object. Up to five different colors can be specified. You must specify at least two color values.

Note that the radial-gradient() function is supported by: Internet Explorer version 10 and higher, Opera version 11.1 and higher, Chrome version 10 and higher, Safari version 4 and higher, and Firefox version 3.6 and higher.

Radial Center:

or specify the center using
pixels or percentages

( , )

Shape:
Size:

or in place of the shape and size keywords,
specify the size of the radial gradient using
pixels or percentages

( , )

Color 1: (rgb) ( , , )         
Color-Stop

Color 2: (rgb) ( , , )         
Color-Stop

Color 3: (rgb) ( , , )         
Color-Stop

Color 4: (rgb) ( , , )         
Color-Stop

Color 5: (rgb) ( , , )         
Color-Stop

Preview

Style

none