concept

At rule — CSS reference

An at-rule starts with an at-keyword and is parsed according to its specific grammar. Some use a semicolon and others a block; their placement and allowed contents vary. This conditional rule changes a property when the viewport reaches the stated width.

Formal Syntax & Structure

css syntaxcss
@media (min-width: 600px) { .panel { color: blue; } }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>at-rule</title><style>body{margin:8px;font:16px/1.5 sans-serif;color:black;background:white}#a{box-sizing:border-box}#a{color:black}@media(min-width:600px){#a{color:blue}}</style><body><div id="a">Example</div></body></html>
CSS Reference