Skip to main content

no-unknown-custom-media

禁止未知的自定义媒体查询。

¥Disallow unknown custom media queries.

@custom-media --sm (min-width: 40rem);
/** ↑

* This custom media query name */

@media (--sm) {}
/** ↑

* And this one */

此规则认为在同一源中定义的自定义媒体查询是已知的。

¥This rule considers custom media queries defined within the same source to be known.

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

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

选项

¥Options

true

以下模式被视为问题:

¥The following patterns are considered problems:

@media (--sm) {}

@media (--sm), (max-height: 40rem) {}

以下模式不被视为问题:

¥The following patterns are not considered problems:

@custom-media --sm (min-width: 40rem);

@media (--sm), (max-height: 40rem) {}
note

@custom-media 名称可以在声明之前使用

¥[!NOTE] The @custom-media name can be used before its declaration

@media (--lg) {}

@custom-media --lg (min-width: 60rem);