Test a card grid at a named container breakpoint
Admin ·
A component can have different space in a sidebar and a full-width content area on the same page. Verify both layouts by changing the component's containing width.
Resize the named container through 360 px
The default workshop query starts at 360 px. The preview starts at 280 px with one computed grid column and an 8 px gap.
Move Preview container width from 359 px to 360 px while the page stays the same width. The grid switches to two columns and the matching rule sets a 12 px gap.
Give the matching grid an upper bound
Choose Between and set the minimum to 360 and maximum to 560. Set Matching columns to 3. The three-column layout applies at both endpoints.
Set the preview to 561 px. The preview returns to the original one-column rule because the width is outside the declared range.
Apply the exported rules to your layout
Download CSS. Apply cq-container to the containing element and cq-layout to the grid inside it. The CSS assigns the container's name and inline-size query type.
Keep the grid inside the named element when integrating these classes. The rule evaluates the nearest eligible ancestor with that name.
Common questions
Why can the layout change while the page width stays fixed?
The size query evaluates the width of the selected containing element. This lets different regions of one page use different layouts.
What if the two-column rule stays inactive in my project?
Check that the grid sits inside an eligible container with the name used in the @container rule. Compare the containing width with the exported threshold.