Layout and responsive: Mobile media query
A max-width media query applies at and below its boundary; the base layout should remain usable without it.
Current edit
Understand the pattern
A max-width media query applies at and below its boundary; the base layout should remain usable without it.
A max-width media query applies at and below its boundary; the base layout should remain usable without it.
Misconceptions to reject
- If the page fits one desktop viewport, no narrower viewport needs checking.
- Hiding all overflow always makes content accessible.
The preview is a sanitized subset, not a full browser compatibility test.
Worked example and expected result
.layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 40rem) { .layout { grid-template-columns: 1fr; } }
.layout { gap: 1rem; }A max-width media query applies at and below its boundary; the base layout should remain usable without it.
Explain it
Apply it elsewhere
Keep the momentum.
Complete the lab, then explain and apply the pattern.
Next: Layout and responsive: Desktop media queryTry an incident drillAnonymous lesson and mastery progress lasts for this session. Sign in to keep synced lesson XP between sessions; mastery stays device-local. No speed bonus, lost lives, or hint penalties.
Keep learning
- 01Layout and responsive: Responsive imagesA percentage width responds to the containing block; automatic height preserves aspect ratio.Practice
- 02Layout and responsive: Desktop media queryA min-width query layers a wider arrangement on top of a simple mobile-first layout.Practice
- 03Layout and responsive: Source orderVisual reordering can differ from keyboard and reading order. Preserve meaningful source order instead.Practice