concept

Media query only — CSS reference

The only modifier before a media type has no effect on modern query evaluation. Historically it hid queries from older media-type-only parsers. It does not make screen exclusive of device classes.

Formal Syntax & Structure

css syntaxcss
@media only screen and (min-width: 600px) { /* conditional declarations */ }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>media-query-only</title><style>body{margin:0}#a{padding:8px;background:rgb(232,237,241);color:rgb(0,0,0);box-sizing:border-box}@media only screen and (min-width: 600px) {#a{color:rgb(0,100,0)}}</style><body><main id="a">Resize the viewport to explore this example.</main></body></html>
CSS Reference