font-weight-notation
数値または名前付き(可能な場合)のfont-weight
値を要求します。
a { font-weight: bold; }
/** ↑
* This notation */
a { font: italic small-caps 600 16px/3 cursive; }
/** ↑
* And this notation, too */
@font-face { font-weight: normal bold; }
/** ↑
* Multiple notations are available in @font-face */
このルールは、$sass
、@less
、およびvar(--custom-property)
の変数構文を無視します。
fix
オプションは、このルールによって報告されたすべての問題を自動的に修正できます。
オプション
string
: "numeric"|"named-where-possible"
"numeric"
font-weight
の値は常に数値でなければなりません。
次のパターンは問題と見なされます
a { font-weight: bold; }
a { font: italic normal 20px sans-serif; }
@font-face { font-weight: normal bold; }
次のパターンは問題とは見なされません
a { font-weight: 700; }
a { font: italic 400 20px; }
@font-face { font-weight: 400 700; }
"named-where-possible"
font-weight
の値は、適切なキーワードが利用可能な場合は常にキーワードでなければなりません。
これは、キーワード相当(normal
とbold
)を持つ数値は400
と700
だけであるため、それらが拒否されることを意味します。
次のパターンは問題と見なされます
a { font-weight: 700; }
a { font: italic 400 20px sans-serif; }
次のパターンは問題とは見なされません
a { font-weight: bold; }
a { font: italic normal 20px sans-serif; }
オプションのセカンダリオプション
ignore: ["relative"]
relativeキーワード名であるbolder
とlighter
を無視します。
次のパターンは問題とは見なされません
a { font-weight: 400; }
a b { font-weight: lighter; }