function-linear-gradient-no-nonstandard-direction
Disallow non-standard direction values for linear gradient functions.
.foo { background: linear-gradient(to top, #fff, #000); }/** ↑ * This (optional) first argument is the "direction" */Use this rule to avoid declarations that browsers ignore. A direction without to, e.g. linear-gradient(top, red, blue), invalidates the whole declaration.
A valid and standard direction value is one of the following:
- an angle
toplus a side-or-corner (to top,to bottom,to left,to right;to top right,to right top,to bottom left, etc.)
This rule doesn’t have any message arguments.
Options
Section titled “Options”{ "function-linear-gradient-no-nonstandard-direction": true}The following patterns are considered problems:
.foo { background: linear-gradient(top, #fff, #000); }.foo { background: linear-gradient(bottom, #fff, #000); }.foo { background: linear-gradient(left, #fff, #000); }.foo { background: linear-gradient(45, #fff, #000); }.foo { background: linear-gradient(to top top, #fff, #000); }The following patterns are not considered problems:
.foo { background: linear-gradient(to top, #fff, #000); }.foo { background: linear-gradient(to bottom right, #fff, #000); }.foo { background: linear-gradient(45deg, #fff, #000); }.foo { background: linear-gradient(1.57rad, #fff, #000); }/* Direction defaults to "to bottom" */.foo { background: linear-gradient(#fff, #000); }