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 */

选项

¥Options

object{ "name": ["array", "of", "units"]|"unit" }

如果功能名称被 "/" 包围(例如 "/height/"),则它被解释为正则表达式。例如,这可以轻松定位简写:/height/ 将匹配 heightmin-heightmax-height 等。

¥If a feature name is surrounded with "/" (e.g. "/height/"), it is interpreted as a regular expression. This allows, for example, easy targeting of shorthands: /height/ will match height, min-height, max-height, etc.

鉴于:

¥Given:

{
"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) {}