跳至主要內容

declaration-property-unit-disallowed-list

在宣告中指定不允許的屬性和單位配對清單。

a { width: 100px; }
/** ↑ ↑
* These properties and these units */

message 次要選項 可以接受此規則的參數。

選項

物件{ "未加前綴的屬性名稱": ["陣列", "單位"]|"單位" }

如果屬性名稱以 "/" 包圍(例如 "/^animation/"),則會將其解釋為正規表示式。這允許輕鬆地針對速記進行目標設定:/^animation/ 將會比對 animationanimation-durationanimation-timing-function 等。

已提供

{
"font-size": ["em", "px"],
"/^animation/": "s"
}

以下模式被視為問題

a { font-size: 1em; }
a { animation: animation-name 5s ease; }
a { -webkit-animation: animation-name 5s ease; }
a { animation-duration: 5s; }

以下模式不會被視為問題

a { font-size: 1.2rem; }
a { height: 100px; }
a { animation: animation-name 500ms ease; }
a { -webkit-animation: animation-name 500ms ease; }
a { animation-duration: 500ms; }