CSS Full Course Day 11 [Hindi] 💻 | Grid Areas, Gaps & Flow 🚀 | Mohit Decodes
🧩 CSS Tutorial – Day 11: Grid Areas, Gaps & Flow
Welcome to Day 11 of the CSS Full Course [Hindi] by Mohit Decodes! Today, we’ll explore advanced CSS Grid features like defining grid areas, controlling gaps, and understanding grid flow.
🔹 Grid Areas
- Define named areas of the grid for easier layout control
- Use
grid-template-areas
on the container and assigngrid-area
to items
css
CopyEdit
.container {
display: grid;
grid-template-columns: 150px 1fr 150px;
grid-template-rows: 100px 200px;
grid-template-areas:
"header header header"
"sidebar content ads";
gap: 10px;
}
.header {
grid-area: header;
}
.sidebar {
grid-area: sidebar;
}
.content {
grid-area: content;
}
.ads {
grid-area: ads;
}
🔹 Grid Gaps
- Use
gap
orgrid-gap
to set spacing between rows and columns - Makes grid layouts cleaner and easier to read
🔹 Grid Auto Flow
- Controls how auto-placed items fill the grid (
row
orcolumn
) - Property:
grid-auto-flow
- Example:
grid-auto-flow: column;
💡 Tips:
- Named grid areas simplify complex layouts
- Use gaps instead of margins for consistent spacing
- Adjust grid-auto-flow to change item placement dynamically