CSS Studio
Interactive Learning
max-width queries overlap. Put narrower breakpoints after wider ones so overrides win. Container queries need container-type on an ancestor.
Media & Container
Media Queries & Container Queries
Responsive CSS is easier when you can see the active rule. This playground gives you a draggable page viewport and a nested container with container-type set so @media and @container queries both light up. Watch sm, md, and lg indicators flip as you resize. Prefer container queries when a card should adapt to its slot, not the whole browser. Keep media queries for page chrome and global typography.
What people get wrong
max-width queries overlap. Put narrower breakpoints after wider ones so overrides win. Container queries need container-type on an ancestor.
- When should I use @container instead of @media?
- Use @container when the same card appears in a narrow sidebar and a wide main column. Use @media for whole-page layout and device-level concerns.
Sizes
Active rules
Page breakpoint: lg
- No max-width media rules active
Container breakpoint: sm
- @container (max-width: 480px)
Queries lab
Container-aware card
Stacked layout (@container max-width: 480px)