Skip to content
Skillpedia
Websites & UI (frontend)75k · #3040

subgrid

What it does

This skill shows how to use CSS subgrid so nested items line up with the rows or columns of a parent grid. It is for web builders whose card layouts look uneven.

When to use it

  • ✓When a card grid has titles, text or buttons that do not line up across cards.
  • ✓When someone asks to align nested grid items without using JavaScript.
  • ✓When reviewing CSS grid layouts where child items should follow the parent grid tracks.

Skill link

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/subgrid/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/subgrid/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“My product cards look uneven because the titles and buttons don't line up. Can you fix the layout with CSS only?”

5 new skills a week. 1 minute to read.

How it works

The agent makes child elements use the parent grid's rows or columns. The browser then lines up the matching parts of each card on its own.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Use CSS subgrid to align nested grid items to parent tracks

Card grids are one of the most common UI patterns, but aligning content across cards — matching title heights, content areas, and footers — 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.

Quick Reference

  • subgrid lets a nested grid inherit its parent grid tracks instead of creating new ones
  • Solves misaligned card titles, content, and footers across rows of cards
  • No JavaScript height matching needed — the browser handles track alignment
  • Universal support: Safari 16+, Chrome/Edge 117+, Firefox 71+

Check

Look 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.

Fix

Convert 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.

Explain

Explain 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.

Code Review

Review 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 — and show the subgrid equivalent.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/css/subgrid

FAQ

Does subgrid work in all browsers?

The skill notes support in Safari 16 and later, Chrome and Edge 117 and later, and Firefox 71 and later.

Is subgrid better than using JavaScript to match heights?

According to this skill, yes. The browser handles the alignment, so no script is needed to measure and match heights.

Should I use subgrid for columns or for rows?

It depends on which direction needs to match. The skill explains both cases so the agent can pick the right one.

Details

Original description by the author

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.

repo: thedaviddias/Front-End-Checklist

Popularity

GitHub stars
75k
Ranking position
#3040
License
MIT
Updated
10/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills