liveBook · Manning

Color stop

As explained in Web Design Playground, Second Edition

A gradient stop is a position in a CSS gradient at which a specified color occurs.

A color stop marks the position in a CSS gradient where one color ends and the next begins. Think of it as a milestone on the gradient’s color journey. section 17.9

Use color stops to control how a gradient changes:

  • Place a percentage after a color to set its transition position, such as white 25%. section 17.9
  • Let the first and last colors use their defaults: 0% at the beginning and 100% at the end. section 17.9
  • Reuse the same stop idea in both linear-gradient() and radial-gradient(). section 17.10

A gradient with a middle stop

background-image: linear-gradient(to top right, red, white 25%, blue); The gradient starts with red, reaches white at 25%, and finishes with blue. section 17.9

div {
    background-color: blue;                                                #1
    background-image: linear-gradient(to top right, red, white 25%, blue); #2
    height: 175px;                                                         #3
    width: 100%;      
}

Inspect a complete CSS example showing a directional gradient with an explicitly positioned middle color stop. section 17.9

How Web Design Playground, Second Edition covers it

How deep it goes
Defines stop positions and defaults, then demonstrates them in gradient declarations without exploring rendering internals.
Examples
Uses a red-white-blue diagonal gradient and a five-color left-to-right gradient with explicit percentages.
What it assumes
Assumes familiarity with CSS color values and background-image declarations.
What you can do after
Apply color stops via CSS gradient declarations to place transitions at deliberate percentages.
How it connects
Connects color stops with CSS gradients, linear-gradient(), radial-gradient(), background-image, and color values.

Also explained in

Compare how 3 books explain color stop →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Design Playground, Second Edition. The section links point to the parts of the book it draws on.