BCA Student Stories & UpdatesLive
CSS Grid System 2: Spanning & Newspaper Magazine Layout
Grid items do not have to be uniform squares. Using column and row spanning, individual grid items can stretch across multiple tracks to create captivating editorial designs.
Day 17 Step-by-Step Practical Flow
🎯1. What You Will Learn Today
CSS Grid System 2: Spanning & Newspaper Magazine Layout — Comprehensive Practical Guide
Har concept ko visual mental models, code anatomy aur practical industry tips ke sath samjhein.
Grid items do not have to be uniform squares. Using column and row spanning, individual grid items can stretch across multiple tracks to create captivating editorial designs.
"Look at the front page of a newspaper: The lead headline spans across 4 columns, while smaller side stories occupy single columns."
👨🏫3. Teacher Demonstration Code
First item spans 2 columns to dominate visual hierarchy.
<style>
.magazine-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px;
}
.featured-story {
grid-column: span 2;
background: #000000;
color: #ffffff;
padding: 30px;
border-radius: 16px;
}
.side-story {
background: #f8fafc;
padding: 20px;
border: 1px solid #e2e8f0;
border-radius: 16px;
}
</style>
<div class="magazine-grid">
<article class="featured-story">
<h2>Lead Story: Artificial Intelligence in BCA</h2>
<p>How modern full-stack students build production systems.</p>
</article>
<article class="side-story">
<h3>Linux CLI</h3>
<p>Essential bash scripts.</p>
</article>
</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 17 Practical Task Test Studio
Add `grid-column: span 2;` to .hero-card.
Spot the Bug: Column Span Exceeding Total Grid Tracks
Tap or click on the exact line below that contains the error:
Click any code line.grid-wrapper { display: grid; grid-template-columns: repeat(2, 1fr); /* Container only has 2 columns! */}.banner { grid-column: span 4; /* Spanning 4 columns on a 2-column grid creates empty ghost tracks */}Senior Developer Forensic Analysis:
Spanning more columns than defined in grid-template-columns forces the browser into implicit grid creation, breaking the intended layout.
📝Independent Practice: Assignment
📄 magazine-layout.htmlHomework Task: Tech News Editorial Dashboard
- •Create folder `day-17` with `index.html`.
- •Build a 4-column news magazine layout.
- •Lead story: Spans 2 columns and 2 rows (`grid-column: span 2; grid-row: span 2;`).
- •Add 4 regular news cards filling the remaining grid slots.
- •Add a full-width footer spanning all 4 columns (`grid-column: 1 / -1;`).
Open Visual Studio Code on your PC (code .), create magazine-layout.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 17 - CSS Grid Newspaper Magazine Layout</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Segoe UI', Tahoma, sans-serif;
background: #0f172a;
color: white;
padding: 32px 16px;
}
.magazine-container {
max-width: 1080px;
margin: 0 auto;
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
}
/* Lead Story spans 2 columns and 2 rows */
.lead-story {
grid-column: span 2;
grid-row: span 2;
background: #1e293b;
border: 1px solid #3b82f6;
border-radius: 16px;
padding: 32px;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.lead-story h2 { font-size: 26px; color: #38bdf8; margin: 12px 0; }
.lead-story p { color: #cbd5e1; font-size: 15px; line-height: 1.6; }
/* Regular News Cards */
.news-card {
background: #1e293b;
border: 1px solid #334155;
border-radius: 12px;
padding: 20px;
}
.news-card h3 { font-size: 15px; color: white; margin-bottom: 8px; }
.news-card p { font-size: 12px; color: #94a3b8; line-height: 1.5; }
/* Footer spans full width (all 4 columns) */
.magazine-footer {
grid-column: 1 / -1;
background: #0f172a;
border-top: 1px solid #334155;
padding: 20px 0;
text-align: center;
font-size: 13px;
color: #64748b;
}
.badge {
display: inline-block;
padding: 3px 8px;
border-radius: 4px;
background: #2563eb;
font-size: 10px;
font-weight: bold;
}
</style>
</head>
<body>
<div class="magazine-container">
<article class="lead-story">
<div>
<span class="badge">BREAKING • TECH</span>
<h2>NextSem Launches 360-Day BCA Practical Curriculum</h2>
<p>A ground-breaking interactive engineering curriculum allowing students to study on their mobile phone while simultaneously building verified software in Visual Studio Code on their PC.</p>
</div>
<div style="font-size: 12px; color: #64748b; margin-top: 20px;">By Er. Manoj Kumar • 5 min read</div>
</article>
<article class="news-card">
<span class="badge" style="background: #10b981;">CLOUD</span>
<h3>Firebase Hosting Deployed</h3>
<p>Instant static assets delivered through global CDN endpoints with 0ms hydration.</p>
</article>
<article class="news-card">
<span class="badge" style="background: #7c3aed;">GITHUB</span>
<h3>CI/CD Pipeline Verification</h3>
<p>Automated repository checks verify student code pushes line-by-line.</p>
</article>
<article class="news-card">
<span class="badge" style="background: #f59e0b;">UI/UX</span>
<h3>CSS Grid 2 Spanning Rules</h3>
<p>Mastering grid-column: span 2 and grid-row: span 2 for responsive dashboards.</p>
</article>
<article class="news-card">
<span class="badge" style="background: #ef4444;">VIVA</span>
<h3>100% Viva Voce Pass Rate</h3>
<p>All active students scored 100% on their Day 17 technical inspection questions.</p>
</article>
<footer class="magazine-footer">
NextSem BCA Computer Science Gazette • All 4 Columns Spanned via grid-column: 1 / -1
</footer>
</div>
</body>
</html>🎓4. Viva Check: Mandatory Conceptual Test
What does `grid-column: 1 / -1` accomplish on a CSS Grid item?
5. Mandatory Step: Push to GitHub to Unlock Next Lesson
Target Repo: html-css-projects
Exact GitHub Setup Guide & Expected Structure
Day 17 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-17/ 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 17 freely! To officially submit your GitHub repository and unlock subsequent days in your portfolio, please complete Day 16: CSS Grid System 1: Templates, Columns & Fractional Units first.
Complete Day 16 First