"매 2D layout 의 native primitive". CSS Grid 매 row + column 동시 control 의 layout system — 매 Flexbox 의 1D 보완. 매 2026 현재 매 모든 modern browser 매 stable, 매 subgrid + masonry (experimental) 까지 지원, 매 page-level 부터 component-level 까지 default tool.
매 핵심
매 모델
Grid container (display: grid) — 매 parent.
Grid items — 매 direct children, 매 line-based positioning.
Tracks — rows + columns, 매 fr unit (fractional space) + minmax() + auto.
Areas — 매 named regions, 매 semantic layout description.
매 vs Flexbox
Grid: 매 2D (row + column 동시), 매 layout-first (parent decides).
Flexbox: 매 1D (single axis), 매 content-first (children sizing).
매 함께 mix — 매 outer Grid + inner Flex 매 common.
매 응용
Page layout (header / sidebar / main / footer).
Card grid 매 responsive (auto-fill + minmax).
Dashboard 매 named-area complex layout.
Image gallery 매 masonry.
💻 패턴
Holy Grail layout
.layout{display:grid;grid-template-columns:200px1fr200px;grid-template-rows:auto1frauto;grid-template-areas:"header header header""nav main aside""footer footer footer";min-height:100vh;}.header{grid-area:header;}.nav{grid-area:nav;}.main{grid-area:main;}.aside{grid-area:aside;}.footer{grid-area:footer;}
.feed{display:grid;grid-template-columns:repeat(4,1fr);grid-auto-flow:dense;/* fill holes */grid-auto-rows:100px;}.feed>.featured{grid-column:span2;grid-row:span2;}
매 결정 기준
상황
Approach
Page-level 2D layout
Grid
Component 매 1D row/column
Flex
Aligned nested grids
Grid + subgrid
Dynamic content count, fluid wrap
Grid auto-fill
Dense irregular packing
Grid auto-flow: dense
기본값: 매 layout-first 결정 — Grid. 매 content-first sizing — Flex.