本文へスキップ

function-linear-gradient-no-nonstandard-direction

linear-gradient関数の非標準の方向値を禁止します。

.foo { background: linear-gradient(to top, #fff, #000); }
/** ↑
* This (optional) first argument is the "direction" */

有効で標準的な方向値は次のいずれかです。

  • 角度
  • toと側面または角(to topto bottomto leftto right; to top rightto right topto bottom leftなど)

(古い非標準構文に一致する)よくある間違いは、先行するtoなしに側面または角だけを使用することです。

オプション

true

次のパターンは問題とみなされます。

.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); }

次のパターンは問題とみなされません

.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); }