Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Advanced Grid – Named Areas & Sub‑Grids | CSS Course lesson | BraveProgrammer
  1. Courses
  2. /
  3. CSS Course

Lesson 28 of 50

·css

Advanced Grid – Named Areas & Sub‑Grids

12 mins

Course progress56%

What you'll learn

Keep these ideas in mind as you work through the lesson.

3 points
  • `grid-template-areas` improve readability for complex layouts.
  • `subgrid` allows deeper nesting without redefining column sizes.
  • Use `auto-fit`/`auto-fill` with `minmax()` for responsive card grids.

Named grid areas make markup readable.

.grid {
  display:grid;
  grid-template-areas:
    "header header header"
    "nav    main   aside"
    "footer footer footer";
}
header { grid-area:header; }
nav    { grid-area:nav; }
main   { grid-area:main; }
aside  { grid-area:aside; }
footer { grid-area:footer; }

Sub‑grid (supported in Chrome 111+, Safari 16+) lets a child grid inherit the parent’s line definitions.

Example: Sub‑grid for a card list

.gallery {
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(200px,1fr));
  gap:1rem;
}
.card {
  display:grid;
  grid-template-columns: subgrid; /* inherits .gallery cols */
  gap:0.5rem;
}
Make it stickPractice what you've learned1 quiz · 6 practical tests · Optional activities from CSS CourseBrowse activities
Previous lessonCSS Grid – FundamentalsContinue to lesson 29Flexbox – FundamentalsBack to CSS Course curriculum