Course offer · HLD · LLD · System Design at ₹799 until 30 Nov (not interview packs)

CSS Studio

Interactive Learning

On this tool

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

900px
420px

Active rules

Page breakpoint: lg

  • No max-width media rules active

Container breakpoint: sm

  • @container (max-width: 480px)
Generated CSS
From the controls
Loading editor…
Page viewport · 900px · lg

Queries lab

Container · 420px

Container-aware card

Stacked layout (@container max-width: 480px)