A color scale, or gradient, lets one background move from one color to another instead of staying a single hue. Think of a wash of paint that changes color across a page element. CSS can create that effect as a background image, so you do not need to supply an image file. section 17.18
Choose how the colors should travel:
- A linear gradient changes color along a straight line. Set its direction with an angle or a direction such as `to top right`. section 17.18 section 17.19
- A radial gradient changes color outward from a point, forming a circle or ellipse. section 17.18
- Color stops set where colors occur in the transition. If you leave their positions out, the browser spaces them for you. section 17.19 section 17.21
A three-color background
```css div { background-color: blue; background-image: linear-gradient(to top right, red, white 25%, blue); height: 175px; width: 100%; } ``` The color travels from the bottom left toward the top right. White reaches its stop at 25%, earlier than the halfway position it would receive by default. The blue `background-color` gives a browser that cannot display the gradient a solid-color fallback. section 17.22 section 17.21
For an outward-moving version, try `radial-gradient(ellipse farthest-corner at left top, yellow, blue)` as the `background-image` value. Modern browsers support both gradient types without vendor prefixes; putting a `background-color` first provides a fallback for older browsers. section 17.25 section 17.27
Want to play? In the Web Design Playground’s Gradient Construction Kit, choose Linear or Radial, pick colors and stops, then watch the preview and copy the resulting CSS. Try moving a middle color stop and see how the blend changes. section 17.28 section 17.21




