BCA Student Stories & UpdatesLive
CSS Grid System 1: Templates, Columns & Fractional Units
CSS Grid is a 2-dimensional layout engine designed for organizing content into precise rows and columns simultaneously, making complex multi-column layouts effortless.
Day 16 Step-by-Step Practical Flow
🎯1. What You Will Learn Today
CSS Grid System 1: Templates, Columns & Fractional Units — Comprehensive Practical Guide
Har concept ko visual mental models, code anatomy aur practical industry tips ke sath samjhein.
CSS Grid is a 2-dimensional layout engine designed for organizing content into precise rows and columns simultaneously, making complex multi-column layouts effortless.
"Flexbox is like stringing beads on a necklace (1D line). CSS Grid is like an Excel spreadsheet or graph paper with defined rows and columns (2D grid)."
👨🏫3. Teacher Demonstration Code
Equal 3-column dashboard using repeat(3, 1fr) and 20px gap.
<style>
.dashboard-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20px;
padding: 24px;
background: #000000;
}
.metric-card {
background: #111827;
color: #ffffff;
padding: 24px;
border-radius: 12px;
border: 1px solid #1f2937;
}
</style>
<div class="dashboard-grid">
<div class="metric-card"><h2>90 Days</h2><p>Sprint 1 Completed</p></div>
<div class="metric-card"><h2>100%</h2><p>Viva Verified</p></div>
<div class="metric-card"><h2>10 Stars</h2><p>GitHub Projects</p></div>
</div>2. Hands-On Practical Lab: Follow Instructions in VS Code
Code like a professional software engineer! Follow the step-by-step instructions below in Visual Studio Code (VS Code) on your PC, test your output locally, and push to GitHub.
Day 16 Practical Task Test Studio
Add `display: grid;` and `grid-template-columns: repeat(3, 1fr);` to .stats-grid.
Add `gap: 20px;` to .stats-grid.
Spot the Bug: Fixed Pixel Columns Overflowing on Mobile
Tap or click on the exact line below that contains the error:
Click any code line.container { display: grid; grid-template-columns: 400px 400px 400px; /* Total 1200px breaks on mobile screens! */}Senior Developer Forensic Analysis:
Using fixed pixel widths prevents columns from shrinking to fit smaller screens. Fractional units (1fr) scale dynamically to container bounds.
📝Independent Practice: Assignment
📄 project-gallery.htmlHomework Task: Student Portfolio Project Gallery
- •Create folder `day-16` with `index.html`.
- •Create a 6-item project showcase gallery.
- •Use `display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;`.
- •Style each project card with title, tech stack badge, and a GitHub view button.
Open Visual Studio Code on your PC (code .), create project-gallery.html, paste this complete step-by-step verified code, test in your browser, and push to your GitHub repo:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BCA Day 16 - CSS Grid Project Gallery</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Segoe UI', Tahoma, sans-serif;
background: #0b1120;
color: white;
padding: 32px 16px;
}
.wrapper { max-width: 1040px; margin: 0 auto; }
h1 { font-size: 24px; color: #38bdf8; margin-bottom: 8px; text-align: center; }
p.lead { color: #94a3b8; font-size: 14px; text-align: center; margin-bottom: 32px; }
/* 6-Item CSS Grid with repeat(auto-fit, minmax(280px, 1fr)) */
.grid-gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 24px;
}
.project-card {
background: #1e293b;
border: 1px solid #334155;
border-radius: 14px;
padding: 24px;
display: flex;
flex-direction: column;
justify-content: space-between;
transition: transform 0.2s ease, border-color 0.2s ease;
}
.project-card:hover {
transform: translateY(-4px);
border-color: #38bdf8;
}
.day-badge {
font-size: 11px;
font-weight: 800;
color: #38bdf8;
margin-bottom: 8px;
}
.project-card h3 { font-size: 16px; margin-bottom: 8px; }
.project-card p { font-size: 13px; color: #94a3b8; line-height: 1.5; margin-bottom: 16px; }
.tag-row {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 18px;
}
.tag {
font-size: 10px;
background: #0f172a;
border: 1px solid #334155;
color: #cbd5e1;
padding: 2px 8px;
border-radius: 4px;
}
.btn-github {
padding: 8px 14px;
background: #2563eb;
color: white;
text-decoration: none;
border-radius: 8px;
font-size: 12px;
font-weight: bold;
text-align: center;
}
.btn-github:hover { background: #1d4ed8; }
</style>
</head>
<body>
<div class="wrapper">
<h1>BCA Semester 1 Practical Project Showcase</h1>
<p class="lead">Built using responsive CSS Grid with auto-fit fractional columns.</p>
<div class="grid-gallery">
<div class="project-card">
<div>
<div class="day-badge">DAY 01 • HTML SETUP</div>
<h3>Student Launch Webpage</h3>
<p>Initial HTML5 boilerplate with semantic structure and browser verification.</p>
<div class="tag-row"><span class="tag">HTML5</span><span class="tag">VSCode</span></div>
</div>
<a href="https://github.com" class="btn-github">View GitHub Repository</a>
</div>
<div class="project-card">
<div>
<div class="day-badge">DAY 04 • LISTS & TABLES</div>
<h3>Syllabus Matrix Portal</h3>
<p>Structured table formatting with rowspan, colspan, and accessibility captions.</p>
<div class="tag-row"><span class="tag">HTML Tables</span><span class="tag">Matrix</span></div>
</div>
<a href="https://github.com" class="btn-github">View GitHub Repository</a>
</div>
<div class="project-card">
<div>
<div class="day-badge">DAY 05 • FORMS</div>
<h3>Job Application Portal</h3>
<p>Client-side form validation with regex pattern matching and semantic fieldsets.</p>
<div class="tag-row"><span class="tag">Forms</span><span class="tag">Validation</span></div>
</div>
<a href="https://github.com" class="btn-github">View GitHub Repository</a>
</div>
<div class="project-card">
<div>
<div class="day-badge">DAY 06 • SEMANTICS</div>
<h3>College Campus Portal</h3>
<p>Clean semantic architecture with header, nav, main, article, aside, and footer.</p>
<div class="tag-row"><span class="tag">Semantics</span><span class="tag">SEO</span></div>
</div>
<a href="https://github.com" class="btn-github">View GitHub Repository</a>
</div>
<div class="project-card">
<div>
<div class="day-badge">DAY 09 • SELECTORS</div>
<h3>Component Library</h3>
<p>Modular button variants (.btn-success, .btn-danger) with hover states.</p>
<div class="tag-row"><span class="tag">CSS Selectors</span><span class="tag">DRY</span></div>
</div>
<a href="https://github.com" class="btn-github">View GitHub Repository</a>
</div>
<div class="project-card">
<div>
<div class="day-badge">DAY 15 • FLEXBOX</div>
<h3>Responsive Course Deck</h3>
<p>Equal height pricing and curriculum cards with flex-wrap and alignment.</p>
<div class="tag-row"><span class="tag">Flexbox</span><span class="tag">Layouts</span></div>
</div>
<a href="https://github.com" class="btn-github">View GitHub Repository</a>
</div>
</div>
</div>
</body>
</html>🎓4. Viva Check: Mandatory Conceptual Test
What does 1fr mean in CSS Grid?
5. Mandatory Step: Push to GitHub to Unlock Next Lesson
Target Repo: html-css-projects
Exact GitHub Setup Guide & Expected Structure
Day 16 RequirementsFollow these exact folder and file names to prevent verification errors.
index.html: Avoid spaces or custom names like Alan Turing..html or Index.HTML. Linux/GitHub servers are strictly case-sensitive.day-16/ for today so you don't overwrite previous days.main.You are welcome to read all notes, inspect code snippets, and practice all exercises of Day 16 freely! To officially submit your GitHub repository and unlock subsequent days in your portfolio, please complete Day 15: Flexbox Architecture 2: Align-Items, Flex-Wrap & Responsive Cards first.
Complete Day 15 First