Disallow duplicate properties within declaration blocks.
a { color: pink; color: orange; }
/** ↑ ↑
* These duplicated properties */
This rule ignores variables ($sass
, @less
, --custom-property
).
以下模式被视为违规:
a { color: pink; color: orange; }
a { color: pink; background: orange; color: orange }
以下模式不被视为违规:
a { color: pink; }
a { color: pink; background: orange; }
Ignore consecutive duplicated properties.
They can prove to be useful fallbacks for older browsers.
以下模式被视为违规:
p {
font-size: 16px;
font-weight: 400;
font-size: 1rem;
}
以下模式不被视为违规:
p {
font-size: 16px;
font-size: 1rem;
font-weight: 400;
}
Ignore consecutive duplicated properties with different values.
Including duplicate properties (fallbacks) is useful to deal with older browsers support for CSS properties. E.g. using 'px' units when 'rem' isn't available.
以下模式被视为违规:
/* properties with the same value */
p {
font-size: 16px;
font-size: 16px;
font-weight: 400;
}
/* nonconsecutive duplicates */
p {
font-size: 16px;
font-weight: 400;
font-size: 1rem;
}
以下模式不被视为违规:
p {
font-size: 16px;
font-size: 1rem;
font-weight: 400;
}
Ignore duplicates of specific properties.
给定:
["color", "/background\-/"]
以下模式被视为违规:
a { color: pink; background: orange; background: white; }
a { background: orange; color: pink; background: white; }
以下模式不被视为违规:
a { color: pink; color: orange; background-color: orange; background-color: white; }
a { color: pink; background-color: orange; color: orange; background-color: white; }