Skip to main content

declaration-block-no-shorthand-property-overrides

禁止速记属性覆盖相关的普通属性。

¥Disallow shorthand properties that override related longhand properties.

a { background-repeat: repeat; background: green; }
/** ↑

* This overrides the longhand property before it */

几乎在所有情况下,这都只是作者的疏忽。有关此行为的更多信息,请参阅 MDN 的简写属性文档

¥In almost every case, this is just an authorial oversight. For more about this behavior, see MDN's documentation of shorthand properties.

message 次要选项 可以接受该规则的参数。

¥The message secondary option can accept the arguments of this rule.

选项

¥Options

true

以下模式被视为问题:

¥The following patterns are considered problems:

a {
padding-left: 10px;
padding: 20px;
}
a {
transition-property: opacity;
transition: opacity 1s linear;
}
a {
-webkit-transition-property: opacity;
-webkit-transition: opacity 1s linear;
}
a {
border-top-width: 1px;
top: 0;
bottom: 3px;
border: 2px solid blue;
}

以下模式不被视为问题:

¥The following patterns are not considered problems:

a { padding: 10px; padding-left: 20px; }
a { transition-property: opacity; } a { transition: opacity 1s linear; }
a { transition-property: opacity; -webkit-transition: opacity 1s linear; }