3 breakpointsCard adapts to its container.
Same DOM. Same CSS. Layout, type scale, and visible actions all flex with the parent — never the viewport.
@container cqp (min-width: 360px)
@container cqp (min-width: 620px)
same DOMResizes with its parent. Works inside grids, drawers, anywhere.
Only sees window width. Place this card in a half-width column and the breakpoint lies.
API surfaceAuthoring contract
Set container-type: inline-size + container-name on the host, then declare style rules under @container <name> (min-width: …). Children read the container's inline size, not the viewport. Drop the component into a 320px sidebar or a 1200px main column — it adapts.
| Hook | Values | Effect |
|---|---|---|
container-type | inline-size · size · normal | Establish a query container on the parent. |
container-name | ident | Target a specific container in nested setups. |
@container <name> (…) | any size feature | Apply rules when the container matches. |
cqi / cqw units | 1cqi = 1% container inline-size | Typography that scales to its container. |
| JS event | cqp:resize | Fires with detail.width (px). |
prefers-reduced-motion | — | Morph transitions removed; layout still updates. |
View HTML
<div class="lsd-cqp__pane" style="container-type: inline-size; container-name: cqp;">
<div class="lsd-cqp__card">
<div class="lsd-cqp__card-thumb"></div>
<div class="lsd-cqp__card-body">…</div>
</div>
<div class="lsd-cqp__handle"></div>
</div>
@container cqp (min-width: 620px) {
.lsd-cqp__card { grid-template-columns: 240px 1fr; }
}