concept

Mobile first — CSS reference

Mobile-first styling establishes a usable narrow layout as the default and layers enhancements for larger available space. It does not require a mobile device or prevent additional max-width queries.

Formal Syntax & Structure

css syntaxcss
/* base layout */ @media (min-width: 600px) { ... }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>mobile-first</title><style>body{margin:0}#a{padding:8px;background:rgb(232,237,241);color:rgb(0,0,0);box-sizing:border-box}#a{display:grid;gap:8px;grid-template-columns:1fr}@media(min-width:600px){#a{grid-template-columns:repeat(2,1fr)}}</style><body><main id="a"><div id="b">First</div><div id="c">Second</div></main></body></html>
CSS Reference