Skip to main content

alpha-value-notation

指定 alpha 值的百分比或数字表示法。

¥Specify percentage or number notation for alpha-values.

    a { color: rgb(0 0 0 / 0.5) }
/** ↑

* This notation */

fix 选项 可以自动修复此规则报告的所有问题。

¥The fix option can automatically fix all of the problems reported by this rule.

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

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

选项

¥Options

string"number"|"percentage"

"number"

Alpha 值必须始终使用数字表示法。

¥Alpha-values must always use the number notation.

以下模式被视为问题:

¥The following patterns are considered problems:

a { opacity: 50% }
a { color: rgb(0 0 0 / 50%) }

以下模式不被视为问题:

¥The following patterns are not considered problems:

a { opacity: 0.5 }
a { color: rgb(0 0 0 / 0.5) }

"percentage"

Alpha 值必须始终使用百分比表示法。

¥Alpha-values must always use percentage notation.

以下模式被视为问题:

¥The following patterns are considered problems:

a { opacity: 0.5 }
a { color: rgb(0 0 0 / 0.5) }

以下模式不被视为问题:

¥The following patterns are not considered problems:

a { opacity: 50% }
a { color: rgb(0 0 0 / 50%) }

可选的辅助选项

¥Optional secondary options

exceptProperties: ["/regex/", /regex/, "string"]

反转匹配属性的主要选项。

¥Reverse the primary option for matching properties.

例如 "percentage"

¥For example with "percentage".

鉴于:

¥Given:

["opacity"]

以下模式被视为问题:

¥The following patterns are considered problems:

a { opacity: 50% }
a { color: rgb(0 0 0 / 0.5) }

以下模式不被视为问题:

¥The following patterns are not considered problems:

a { opacity: 0.5 }
a { color: rgb(0 0 0 / 50%) }