Skip to content

noUnknownMediaFeatureName (CSS)

Language CSS
biome.json
{
"linter": {
"rules": {
"correctness": {
"noUnknownMediaFeatureName": "error"
}
}
}
}

Disallow unrecognized feature names in media queries.

Media features describe conditions such as viewport width, display resolution, or user preferences. The rule recognizes names from CSS specifications, including editor drafts, and validates vendor-prefixed names.

See MDN’s media-query reference and the W3C specifications for Media Queries Level 4 and Level 5.

Media feature names containing SCSS interpolation are ignored because the emitted name cannot be determined statically.

@media screen and (unknown > 320px) {}
code-block.css:1:8 lint/correctness/noUnknownMediaFeatureName ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Unexpected unknown media feature name.

> 1 │ @media screen and (unknown > 320px) {}
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

ℹ Browsers treat a media query that contains an unknown feature as not matching. Another query in a comma-separated list can still match.

ℹ You should use media feature names defined in the CSS Specifications.

@media only screen and (min-width: 320px) and (max-width: 480px) and (unknown: 150dpi) {}
code-block.css:1:8 lint/correctness/noUnknownMediaFeatureName ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Unexpected unknown media feature name.

> 1 │ @media only screen and (min-width: 320px) and (max-width: 480px) and (unknown: 150dpi) {}
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

ℹ Browsers treat a media query that contains an unknown feature as not matching. Another query in a comma-separated list can still match.

ℹ You should use media feature names defined in the CSS Specifications.

@media (not(unknown < 320px)) and (max-width > 640px) {}
code-block.css:1:8 lint/correctness/noUnknownMediaFeatureName ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Unexpected unknown media feature name.

> 1 │ @media (not(unknown < 320px)) and (max-width > 640px) {}
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

ℹ Browsers treat a media query that contains an unknown feature as not matching. Another query in a comma-separated list can still match.

ℹ You should use media feature names defined in the CSS Specifications.

@media (400px <= unknown <= 700px) {}
code-block.css:1:8 lint/correctness/noUnknownMediaFeatureName ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Unexpected unknown media feature name.

> 1 │ @media (400px <= unknown <= 700px) {}
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

ℹ Browsers treat a media query that contains an unknown feature as not matching. Another query in a comma-separated list can still match.

ℹ You should use media feature names defined in the CSS Specifications.

@media screen and (width > 320px) {}
@media only screen and (min-width: 320px) and (max-width: 480px) and (resolution: 150dpi) {}
@media (not(min-width < 320px)) and (max-width > 640px) {}
@media (400px <= width <= 700px) {}
@media screen and (-webkit-width > 320px) {}
@custom-media --mobile (max-width: 768px);
@media screen and (--mobile) {}