Coding task · HTML and CSS course · Module 9: Modern CSS
Card Alignment with CSS Subgrid
CSS Subgrid lets descendants inherit the parent's grid! .card { display: grid; grid-row: span 3; grid-template-rows: subgrid; } - this way headers, content, and footers of all cards in the grid are perfectly aligned, like stone blocks of a pyramid.
Task
Create a card gallery with aligned sections. Add grid-template-rows: subgrid to .card and grid-row: span 3 so the card spans 3 rows of the parent. Uncomment subgrid in the CSS and see how headers, content, and footers of all cards align!