Skip to main content

Featured

🎉 Day 46 — React Mastery Completed (Final Summary & Congratulations!)

🎉 Day 46 — React Mastery Completed (Final Summary & Congratulations!) Congratulations, developer! 👏 You’ve successfully completed the 45-Day React.js Roadmap — from understanding the fundamentals to mastering advanced concepts like Redux, Routing, Testing, and Deployment. 📘 What You’ve Learned ✅ React basics — Components, JSX, Props, and State ✅ Hooks — useState, useEffect, useRef, useMemo, and Custom Hooks ✅ Context API and Redux Toolkit for global state management ✅ Routing with React Router & Protected Routes ✅ Data fetching using Fetch API, Axios, React Query ✅ Advanced Patterns — Compound Components, Render Props, HOCs ✅ Styling — CSS Modules, Styled Components, Theming ✅ Animations, Accessibility, Testing, and Performance Optimization ✅ Deployment on Vercel, Netlify, or GitHub Pages 🧩 Final Project Ideas Now that you’re done, build real-world apps to polish your skills: 📝 Task ...

Day 18 : CSS Grid (Advanced, Practical)

🎨 Day 18 — CSS Grid (Advanced, Practical)

Grid is the most powerful layout system for two-dimensional designs. Use it for entire page layouts, galleries, dashboards and complex responsive arrangements.


1 — Basic grid definitions

.container {
  display: grid;
  grid-template-columns: 200px 1fr 300px;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
}

2 — Fractional unit (fr) & repeat()

fr divides remaining space; repeat() reduces repetition.

grid-template-columns: repeat(3, 1fr);

3 — Named grid areas (easy page templates)

.container {
  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; }

4 — Implicit vs explicit grids & auto-placement

The explicit grid is what you define with template-* properties. The implicit grid grows as items are placed outside those tracks. Use grid-auto-rows / grid-auto-columns to control implicit sizing.

5 — Responsive grids & minmax()

minmax() is essential for responsive patterns:

grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));

This produces a gallery that automatically reflows based on available width.


Interactive — Grid demo & play

Open the editor and resize the output frame to see how auto-fit / minmax() react.



Practical patterns & tips

  • Use grid-template-areas for page-level layout (header/nav/main/aside/footer).
  • Use auto-fit/minmax for responsive galleries and card grids.
  • Combine Grid + Flexbox: Grid for layout, Flexbox for items inside each cell.

Practice challenges

  1. Build a 3-column blog layout with header & footer using named areas. Make it responsive to 1 column on small screens.
  2. Create a gallery using repeat(auto-fit,minmax(220px,1fr)) and ensure images maintain aspect ratio.

Comments