{"data":{"slug":"github-thedaviddias-front-end-checklist-skills-subgrid-f40668dd1b35","title":"Align Nested Grid Items with Subgrid","summary":"Use CSS subgrid to align nested grid items with parent tracks for consistent card layouts. This technique ensures that card titles, content, and footers align across a grid of cards without requiring JavaScript.","url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-subgrid-f40668dd1b35","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-thedaviddias-front-end-checklist-skills-subgrid-f40668dd1b35","markdown_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-subgrid-f40668dd1b35.md","download_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-subgrid-f40668dd1b35\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Ensure the parent grid has defined `grid-template-rows` and that nested grid items use `grid-template-rows: subgrid` to inherit the parent's tracks. The first deliverable is a CSS snippet demonstrating subgrid alignment in a card layout.","instructions":"---\nname: subgrid\ndescription: \"Use when reviewing card grid layouts with misaligned content areas, or any nested grid where child items need to align with sibling cards' corresponding sections without JavaScript intervention.\"\nmetadata:\n  category: css\n  priority: low\n  difficulty: intermediate\n  estimatedTime: \"25\"\n  source: frontendchecklist.io\n  url: https:\/\/frontendchecklist.io\/rules\/css\/subgrid\n---\n\n# Use CSS subgrid to align nested grid items to parent tracks\n\nCard grids are one of the most common UI patterns, but aligning content across cards \u2014 matching title heights, content areas, and footers \u2014 has historically required JavaScript height measurement or CSS hacks. Subgrid solves this at the layout engine level: nested items participate directly in the parent grid's tracks, so alignment is automatic, performant, and CSS-only.\n\n## Quick Reference\n\n- subgrid lets a nested grid inherit its parent grid tracks instead of creating new ones\n- Solves misaligned card titles, content, and footers across rows of cards\n- No JavaScript height matching needed \u2014 the browser handles track alignment\n- Universal support: Safari 16+, Chrome\/Edge 117+, Firefox 71+\n\n## Check\n\nLook for card grid layouts in this CSS where card content areas (titles, body text, footers) might not align across cards of different content lengths. These are candidates for subgrid.\n\n## Fix\n\nConvert this card grid to use subgrid. Show how to set grid-template-rows on the parent grid, then apply grid-row: span N and grid-template-rows: subgrid on each card to inherit the parent tracks.\n\n## Explain\n\nExplain how CSS subgrid works, how it differs from a nested grid, what problem it solves with card alignment, and when to use subgrid on columns versus rows.\n\n## Code Review\n\nReview card grid and nested grid layouts in this stylesheet. Flag any layout that uses JavaScript height matching, fixed heights, or display: contents workarounds to achieve cross-card alignment \u2014 and show the subgrid equivalent.\n\n---\n\nFor full implementation details, code examples, and framework-specific guidance,\nsee `references\/rule.md`.\n\nRule page: https:\/\/frontendchecklist.io\/rules\/css\/subgrid\n","use_cases":["Align card titles, content, and footers across a grid of cards","Ensure consistent spacing and alignment in nested grid layouts","Replace JavaScript-based height matching with CSS-only solution"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/thedaviddias\/Front-End-Checklist\/blob\/e8d14d049010e2ce25afcd5e8609dfcbbe63e47e\/skills\/subgrid\/SKILL.md","source_commit":"e8d14d049010e2ce25afcd5e8609dfcbbe63e47e","license":null,"version":null,"listing_approved_at":"2026-11-24","created_at":"2026-11-23T05:48:27.000000Z","updated_at":"2026-11-24T07:12:32.000000Z","seo_title":"Align nested grid items with subgrid","seo_description":"Use CSS subgrid to align nested grid items with parent tracks for consistent card layouts. No JavaScript required.","seo_keywords":["CSS subgrid alignment","nested grid layout","card grid alignment","CSS grid layout","no JavaScript alignment"]}}