You paste one line of CSS into a stylesheet and a flat header turns into a sunset. The line is short, but it does three jobs at once: it names the kind of gradient, sets the direction of the blend, and lists the colors it passes through. Most people copy gradient CSS without reading it, which works until the blend runs the wrong way or the colors land in the wrong order.

This guide takes one real declaration apart, piece by piece, using the free Gradient Palette Explorer on Ovatly: a small curated bank of two and three stop gradients, organized by mood, where every card copies its CSS with one click. By the end you will be able to read any linear gradient line and change its direction on purpose.

Contents

  • Quick answer
  • A direction and a list of colors
  • Angles: where the blend travels
  • Stops: the colors, in order
  • How to copy a gradient from the Explorer, step by step
  • Worked example: taking Ember Sky apart
  • Limitations and honest tradeoffs
  • Common mistakes
  • FAQs
  • Conclusion

Quick answer

A CSS linear gradient declaration has two working parts: a direction and a list of color stops. The direction is an angle such as 135deg, which points the blend diagonally from the top left to the bottom right. The stops are the colors, in order: the first color starts the blend and the last color ends it. Every gradient in the Gradient Palette Explorer is a linear gradient with two or three stops, and the angle is part of each preset, included in the copied CSS. To use one: find a preset by mood, click Copy CSS, and paste the background declaration into your stylesheet.

A direction and a list of colors

Strip a gradient declaration down and two parts remain. The direction says which way the color changes across the element: left to right, top to bottom, or corner to corner. The stop list says what it changes through: the colors, in the order the blend visits them.

Everything else in the line is packaging. The word background is the CSS property the declaration belongs to. The function name linear-gradient says the blend runs in a straight line, the only kind this bank holds. Inside the brackets, the angle comes first and the stops follow it, separated by commas. Read the line in that order and it stops being a spell: it becomes instructions you can predict before you paste it.

That predictability is the real skill. Once you can read a declaration, you can spot why a pasted gradient looks wrong: either the direction is not the one your layout needs, or the stops are not in the order you assumed. Both faults are visible in the text, before anything renders.

Angles: where the blend travels

The angle is measured in degrees and aims the blend. Three values cover most of what you will meet in this bank:

  • 90deg runs the blend left to right.
  • 180deg runs it top to bottom.
  • 135deg runs it diagonally, from the top left to the bottom right.

The angle is part of each preset and is included in the copied CSS. It is also the one part the Explorer expects you to change yourself. If a preset's colors are right but the blend runs across your header when it should run down it, you do not need a different gradient: you edit the angle in the pasted declaration and leave the stops untouched. Changing 135deg to 180deg turns a diagonal blend into a top to bottom one, and nothing else in the line moves.

Stops: the colors, in order

Stops are the hex colors listed after the angle, and their order is their position. The first stop is the color the blend starts from, at the edge the angle points away from. The last stop is where the blend ends up. A two stop gradient is a single sweep from one color to the other. A three stop gradient adds a middle color that the blend passes through on the way, which is how a preset carries a shift in mood inside one blend.

Because the order is positional, swapping two stops reverses which end of the element gets which color. When a gradient looks upside down, the stops are usually fine and the angle is the culprit, so check the direction before rearranging colors.

How to copy a gradient from the Explorer, step by step

  1. Open the Gradient Palette Explorer and browse the grid, or narrow it with the category chips: Warm, Cool, Nature, Vivid and Neutral.
  2. Or search by mood, gradient name or a hex value instead of scrolling.
  3. Click Copy CSS on the card you want. The whole background declaration, angle included, is copied as one piece.
  4. Paste the declaration into your stylesheet where the background belongs.
  5. Preview it in place. If the direction fights your layout, edit the angle in the pasted CSS.

Worked example: taking Ember Sky apart

The Ember Sky card in the Explorer copies this declaration:

background: linear-gradient(135deg, #FF9966, #FF5E62);

Read it piece by piece. background is the property. linear-gradient says the blend travels in a straight line. 135deg is the direction: diagonal, from the top left to the bottom right. Then come the stops, in order: #FF9966, a soft orange, starts the blend, and #FF5E62, a coral red, ends it.

Put the pieces back together and the line predicts the picture exactly: applied to a header or a button, the element blends from a soft orange at the top left to a coral red at the bottom right. Nothing in the declaration is decoration. Remove the angle and the blend loses its direction; swap the stops and the orange and coral trade corners. Every other preset in the bank is built from the same parts.

Limitations and honest tradeoffs

The Explorer is a fixed curated set, not a generator. The same gradients appear for every visitor, and you cannot feed it your own colors: a blend built from stops you chose yourself belongs to the CSS Gradient Generator in Website and Webmaster Tools. Every preset here is linear, so if a design needs a blend that radiates from a center point, this bank has nothing to copy.

One more caution belongs to any gradient: text placed on it needs its contrast checked against the lightest and darkest stops, not just the middle. A headline can pass over the center of a blend and fail at the pale end.

Common mistakes

  • Rearranging the stops when the angle is wrong. A blend running the wrong way is a direction problem. Edit the degree value first; the stop order is usually innocent.
  • Reading the stops backwards. The first listed color is the start of the blend, not the finish. Swapping them flips the gradient end for end.
  • Checking text contrast against the middle of the blend. The middle is the easiest point; check the lightest and darkest stops, where text fails.
  • Expecting the Explorer to generate. It is a bank of hand-picked presets with a copy button; custom colors and stop counts are another tool's job.
  • Copying the colors and dropping the angle. The angle is part of the preset: paste the whole declaration, then edit the direction if you need to.

FAQs

What are the two parts of a CSS gradient declaration? A direction and a list of color stops. The direction is an angle, such as 135deg, that sets which way the blend travels. The stops are the colors in order: the first starts the blend, the last ends it, and a middle stop, when there is one, sits between them.

What does 135deg mean in a gradient? It points the blend diagonally, from the top left to the bottom right. For comparison, 90deg runs left to right and 180deg runs top to bottom. The angle is the direction part of the declaration, and every preset in the Gradient Palette Explorer carries its own.

Can I change the direction of a gradient after copying it? Yes. Edit the angle in the copied CSS. Changing 135deg to 180deg turns a diagonal blend into a top to bottom one, and the stops stay exactly as they were. This is the one edit the Explorer expects you to make by hand.

Are all the gradients in the Explorer linear? Yes. Every preset in the bank is a linear gradient with two or three stops, and the same fixed set appears for every visitor. The Explorer is a curated bank, not a generator.

How do I build a gradient from my own colors? Use the CSS Gradient Generator in Website and Webmaster Tools, which lets you place your own stops. The Gradient Palette Explorer only supplies its hand-picked presets, so a blend built from colors you chose yourself starts there instead.

Conclusion

A gradient declaration is not a spell: it is a direction plus a short list of colors, and you can read both at a glance. The Gradient Palette Explorer keeps that anatomy honest by giving you finished presets to copy rather than a blank generator to guess with. The natural next question is how long that list of colors should be, and our guide to how many color stops a gradient should have settles it with a simple test. For more guides in this series, see our Color and Design Tools guides.