shorthand-property-no-redundant-values
禁止简写属性中存在冗余值。
¥Disallow redundant values within shorthand properties.
a { margin: 1px 1px 1px 1px; }
/** ↑ ↑ ↑
* These values */
你可以使用 速记属性 一次设置多个值。例如,你可以使用 margin 属性一次性设置 margin-top、margin-right、margin-bottom 和 margin-left 属性。
¥You can use shorthand properties to set multiple values at once. For example, you can use the margin property to set the margin-top, margin-right, margin-bottom, and margin-left properties at once.
对于某些简写属性,例如与 盒子的边缘 相关的属性,你可以安全地省略一些值。
¥For some shorthand properties, e.g. those related to the edges of a box, you can safely omit some values.
此规则检查以下速记属性:
¥This rule checks the following shorthand properties:
-
margin,margin-block,margin-inline -
padding,padding-block,padding-inline -
border-color,border-style,border-width -
border-radius -
border-block-color,border-block-style,border-block-width -
border-inline-color,border-inline-style,border-inline-width -
gap,grid-gap -
overflow, -
overscroll-behavior, -
scroll-margin,scroll-margin-block,scroll-margin-inline -
scroll-padding,scroll-padding-block,scroll-padding-inline -
inset,inset-block,inset-inline
fix 选项 可以自动修复此规则报告的所有问题。
¥The fix option can automatically fix all of the problems reported by this rule.
选项
¥Options
true
{
"shorthand-property-no-redundant-values": true
}
以下模式被视为问题:
¥The following patterns are considered problems:
a { margin: 1px 1px; }
a { margin: 1px 1px 1px 1px; }
a { padding: 1px 2px 1px; }
a { border-radius: 1px 2px 1px 2px; }
a { -webkit-border-radius: 1px 1px 1px 1px; }
以下模式不被视为问题:
¥The following patterns are not considered problems:
a { margin: 1px; }
a { margin: 1px 1px 1px 2px; }
a { padding: 1px 1em 1pt 1pc; }
a { border-radius: 10px / 5px; }
可选的辅助选项
¥Optional secondary options
ignore
{ "ignore": ["array", "of", "options"] }
"four-into-three-edge-values"
忽略应用于边时可以缩短为三个值的四值简写声明。
¥Ignore four-value shorthand declarations that could be shortened to three values when applied to edges.
以下模式不被视为问题:
¥The following patterns are not considered problems:
a { margin: 1px 2px 3px 2px; }
a { inset: auto 0 0 0; }