Skip to content

noInvalidDirectionInLinearGradient (CSS)

Language CSS
biome.json
{
"linter": {
"rules": {
"correctness": {
"noInvalidDirectionInLinearGradient": "error"
}
}
}
}

Disallow non-standard directions in linear gradients.

A gradient direction must be either an angle with a unit, such as 45deg, or a side or corner preceded by to, such as to top or to bottom right. Writing only top or a unitless number uses invalid or outdated syntax.

.foo { background: linear-gradient(top, #fff, #000); }
code-block.css:1:36 lint/correctness/noInvalidDirectionInLinearGradient ━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Unexpected nonstandard direction

> 1 │ .foo { background: linear-gradient(top, #fff, #000); }
│ ^^^
2 │

ℹ You should fix the direction value to follow the syntax.

ℹ See MDN web docs for more details.

.foo { background: linear-gradient(45, #fff, #000); }
code-block.css:1:36 lint/correctness/noInvalidDirectionInLinearGradient ━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Unexpected nonstandard direction

> 1 │ .foo { background: linear-gradient(45, #fff, #000); }
│ ^^
2 │

ℹ You should fix the direction value to follow the syntax.

ℹ See MDN web docs for more details.

.foo { background: linear-gradient(to top, #fff, #000); }
.foo { background: linear-gradient(45deg, #fff, #000); }