concept

Media type — CSS reference

A media type describes a broad output category. The current ordinary types are screen, print and all. Prefer feature queries about dimensions or capabilities over attempting to identify a device model.

Formal Syntax & Structure

css syntaxcss
@media screen { /* conditional declarations */ }

Working Example

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