跳到主要內容

字重符號

需要數值或命名 (若可能) 的 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@lessvar(--custom-property) 變數語法。

fix 選項 可以自動修正此規則報告的所有問題。

選項

字串"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必須永遠是關鍵字,當有適當關鍵字時。

這表示只有 400700 會被拒絕,因為這些是唯一有關鍵字等效項 (normalbold) 的數字。

下列模式會被視為問題

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

下列模式不會被視為問題

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

可選的次要選項

ignore: ["relative"]

忽略 相對 關鍵字名稱 bolderlighter

下列模式不會被視為問題

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