Skip to main content

media-feature-name-unit-allowed-list

指定媒体功能中允许的名称和单位对的列表。

¥Specify a list of allowed name and unit pairs within media features.

@media (width: 50em) {}
/** ↑ ↑

* This media feature name and these units */

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

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

选项

¥Options

Array<string>

{ "media-feature-name": ["array", "of", "units"] }

您可以为媒体功能名称指定正则表达式,例如 { "/height$/": [] }

¥You can specify a regex for a media feature name, such as { "/height$/": [] }.

鉴于:

¥Given:

{
"media-feature-name-unit-allowed-list": {
"width": "em",
"/height/": ["em", "rem"]
}
}

以下模式被视为问题:

¥The following patterns are considered problems:

@media (width: 50rem) {}
@media (height: 1000px) {}
@media (min-height: 1000px) {}
@media (height <= 1000px) {}

以下模式不被视为问题:

¥The following patterns are not considered problems:

@media (width: 50em) {}
@media (width <= 50em) {}
@media (height: 50em) {}
@media (min-height: 50rem) {}