Course Technology Cengage Learning New Perspectives on HTML5 and CSS3, 7th Edition
Tutorial 4

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(shape size at position, color-stop1, color-stop2 ...)

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

To use the demo, select the shape and size from the list boxes or specify the size from the input boxes. Note that you can only select one shape/size option. Select the center position using the drop-down list boxes or the input boxes. Once again you can only select one method of positioning. Finally select the colors and stop position of each color. Any omitted parameter values will assume their default values. Up to five different colors can be specified. You must specify at least two color values. Click the checkmark box next to the colors to be placed in the gradient.

Shape:
Size:

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

( , )

Position:

or in place of the keywords, specify the center using
pixels or percentages

( , )

Color 1
Color-Stop

Color 2
Color-Stop

Color 3
Color-Stop

Color 4
Color-Stop

Color 5
Color-Stop

Preview

Style

none