--- id: css-grid-intro title: "CSS Grid Intro" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["CSS Grid", "Grid Layout Module", "two-dimensional layout", "display grid", "grid container"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.89 created_at: 2026-06-23 updated_at: 2026-06-23 review_reason: "" merge_history: [] tags: ["css", "web", "frontend", "w3schools", "grid", "layout"] raw_sources: ["https://www.w3schools.com/css/css_grid.asp"] applied_in: [] github_commit: "" --- # [[CSS Grid Intro]] ## π― ν μ€ ν΅μ°° (One-line insight) The CSS Grid Layout Module offers a grid-based layout system with rows and columns, enabling complex, responsive two-dimensional layouts without using float or positioning. [S1] ## π§ ν΅μ¬ κ°λ (Core concepts) - **Grid Layout Module** β offers a grid-based layout system, with rows and columns, making it easier to design web pages without having to use float or positioning. [S1] - **Two-dimensional** β CSS Grid is used for two-dimensional layout, with rows AND columns; CSS Flexbox is used for one-dimensional layout, with rows OR columns. [S1] - **Grid Container** β the parent element where `display` is set to `grid` or `inline-grid`. [S1] - **Grid Items** β the direct children of the grid container, which automatically become grid items. [S1] ## π§© μΆμΆλ ν¨ν΄ (Extracted patterns) - **Container + items model** β set `display: grid` on the parent; direct children automatically become grid items. [S1] - **Define columns on the container** β `grid-template-columns` controls how many columns and their widths (e.g., `auto auto auto` for three equal columns). [S1] ## π μΈλΆ λ΄μ© (Details) The CSS Grid Layout Module offers a grid-based layout system, with rows and columns, making it easier to design web pages without having to use float or positioning. [S1] **Grid vs Flexbox** CSS Grid is used for two-dimensional layout, with rows AND columns. CSS Flexbox is used for one-dimensional layout, with rows OR columns. [S1] **Grid Components** A grid consists of two essential parts: [S1] 1. **Grid Container** β the parent element where `display` is set to `grid` or `inline-grid`. 2. **Grid Items** β direct children of the grid container that automatically become grid items. **Complete example** [S1] ```html