# CSS linear-gradient(): Syntax, Angles and Examples

DevFeed: [CSS linear-gradient(): Syntax, Angles and Examples](<https://devfeed.tech/articles/css-linear-gradient-syntax-angles-and-examples-127063.md>)

Original publisher: [Read original article](<https://markodenic.com/css-linear-gradient/>)

Author: Marko

Published: 2026-11-10T17:00:00Z

Content type: article

Language: en

Sources: [Marko Denic Blog](<https://devfeed.tech/sources/marko-denic-blog.md>)

Topics: [CSS](<https://devfeed.tech/topics/css.md>), [web animation](<https://devfeed.tech/topics/web-animation.md>), [color](<https://devfeed.tech/topics/color.md>)

Tags: [after](<https://devfeed.tech/tags/after.md>), [all](<https://devfeed.tech/tags/all.md>), [alpha](<https://devfeed.tech/tags/alpha.md>), [animate](<https://devfeed.tech/tags/animate.md>), [animation](<https://devfeed.tech/tags/animation.md>), [avoid](<https://devfeed.tech/tags/avoid.md>), [background](<https://devfeed.tech/tags/background.md>), [background-image](<https://devfeed.tech/tags/background-image.md>), [blending](<https://devfeed.tech/tags/blending.md>), [body](<https://devfeed.tech/tags/body.md>), [color](<https://devfeed.tech/tags/color.md>), [colors](<https://devfeed.tech/tags/colors.md>), [css](<https://devfeed.tech/tags/css.md>), [examples](<https://devfeed.tech/tags/examples.md>), [gradient](<https://devfeed.tech/tags/gradient.md>), [linear](<https://devfeed.tech/tags/linear.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [text](<https://devfeed.tech/tags/text.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>), [with](<https://devfeed.tech/tags/with.md>), [works](<https://devfeed.tech/tags/works.md>)

## AI overview

CSS `linear-gradient()` creates an image that blends at least two color stops along a straight line, so apply it with `background` or `background-image`. Its default direction is top to bottom; `to` keywords target directions or corners, while clockwise angles give a fixed slant. Stop positions control blends and can create sharp edges or solid bands. The text recommends `oklch` for brighter blends between distant hues, with a plain gradient first as a fallback for older browsers. Examples show layered gradients for photo overlays, background clipping for gradient text, and two backgrounds for rounded gradient borders because `border-image` drops rounded corners. `background-image` cannot be transitioned directly; the animated example registers an angle custom property with `@property` and transitions that instead.

## Source excerpt

How CSS linear-gradient() works: directions and angles, color stops, hard stops, smoother colors with oklch, gradient text, overlays and animated gradients.