Responsive design used to mean “at 768px do X.” That breaks in component-based systems where the same card can appear in a sidebar, a modal, or a 3-column grid. Container queries let components respond to their own available space.
.card-wrapper { container-type: inline-size;}.card { display: grid; gap: 1rem;}@container (min-width: 520px) { .card { grid-template-columns: 160px 1fr; align-items: start; }}
Benefit: the card adapts anywhere it’s placed without extra page-level breakpoints.
Subgrid helps when you want child items to align to a parent grid’s columns (e.g., product cards aligning titles and prices across rows). Instead of manually repeating column definitions, the child uses the parent’s grid track definitions.
When to use subgrid
CSS layout checklist
Get the latest course releases and learning insights delivered straight to your inbox each week.
By subscribing you agree to our Privacy Policy and consent to receive updates from SkillNet.