Container Queries Playground

Grandma Marni’s price card pinned in the narrow and wide columns of Mr. Karim’s board: write @container and @media, drag the board and sidebar widths, and the…

Why it matters

Components get reused everywhere: sidebars, grids, modals. With @media you only know the screen’s width, not the slot’s. @container lets a component read its own room, so it really works anywhere.

The key idea

A container query asks an ancestor, not the window

Common mistakes

Try it in this playground