font-weight-notation
需要数字或命名(如果可能)font-weight
值。
¥Require numeric or named (where possible) font-weight
values.
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)
变量语法。
¥This rule ignores $sass
, @less
, and var(--custom-property)
variable syntaxes.
fix
选项 可以自动修复此规则报告的所有问题。
¥The fix
option can automatically fix all of the problems reported by this rule.
选项
¥Options
string
:"numeric"|"named-where-possible"
"numeric"
font-weight
值必须始终是数字。
¥font-weight
values must always be numbers.
以下模式被视为问题:
¥The following patterns are considered problems:
a { font-weight: bold; }
a { font: italic normal 20px sans-serif; }
@font-face { font-weight: normal bold; }
以下模式不被视为问题:
¥The following patterns are not considered problems:
a { font-weight: 700; }
a { font: italic 400 20px; }
@font-face { font-weight: 400 700; }
"named-where-possible"
当适当的关键字可用时,font-weight
值必须始终是关键字。
¥font-weight
values must always be keywords when an appropriate keyword is available.
这意味着只有 400
和 700
将被拒绝,因为这些是唯一具有关键字等效项(normal
和 bold
)的数字。
¥This means that only 400
and 700
will be rejected, because those are the only numbers with keyword equivalents (normal
and bold
).
以下模式被视为问题:
¥The following patterns are considered problems:
a { font-weight: 700; }
a { font: italic 400 20px sans-serif; }
以下模式不被视为问题:
¥The following patterns are not considered problems:
a { font-weight: bold; }
a { font: italic normal 20px sans-serif; }
可选的辅助选项
¥Optional secondary options
ignore: ["relative"]
忽略 bolder
和 lighter
的 relative 关键字名称。
¥Ignore the relative keyword names of bolder
and lighter
.
以下模式不被视为问题:
¥The following patterns are not considered problems:
a { font-weight: 400; }
a b { font-weight: lighter; }