#font-weight-notation

Require numeric or named (where possible) font-weight values. Also, when named values are expected, require only valid names.

要求使用数字或命名的 (可能的情况下) font-weight 值。同时,当需要命名的值时,一定要是有效的命名。

a { font-weight: bold }
/**              ↑
 *   This notation */

a { font: italic small-caps 600 16px/3 cursive; }
/**                         ↑
*      And this notation, too */

Valid font-weight names are normal, bold, bolder, and lighter.

有效的 font-weight 名称是 normalboldbolderlighter

This rule ignores $sass, @less, and var(--custom-property) variable syntaxes.

该规则忽略 $sass@lessvar(--custom-property) 变量语法。

#Options

string: "numeric"|"named-where-possible"

#"numeric"

font-weight values must always be numbers.

font-weight 必须是数字。

The following patterns are considered warnings:

以下模式被认为是个警告:

a { font-weight: bold; }
a { font: italic normal 20px; }

The following patterns are not considered warnings:

以下模式正常:

a { font-weight: 700; }
a { font: italic 900 20px; }

#"named-where-possible"

font-weight values must always be keywords when an appropriate keyword is available.

font-weight 的值必须是关键字(当对应的关键字有效时)。

This means that only 400 and 700 will be rejected, because those are the only numbers with keyword equivalents (normal and bold).

这意味着只有 400700 会被拒绝,因为它们是唯一两个有对应的关键字(normalbold)的数字。

The following patterns are considered warnings:

以下模式被认为是个警告:

a { font-weight: 700; }
a { font: italic 400 20px; }

The following patterns are not considered warnings:

以下模式正常:

a { font-weight: bold; }
a { font: italic normal 20px; }

#Optional secondary options

#ignore: ["relative"]

Ignore the relative keyword names of bolder and lighter.

忽略相对值关键字:bolderlighter

The following patterns are not considered warnings:

以下模式正常:

a { font-weight: 400; }
a b { font-weight: lighter; }