BCA Student Stories & UpdatesLive
Flexbox Architecture 2: Align-Items, Flex-Wrap & Responsive Cards
While justify-content aligns items horizontally, `align-items` aligns them vertically along the cross axis, and `flex-wrap` allows items to drop down to new lines when container space runs out.
Day 15 Step-by-Step Practical Flow
🎯1. What You Will Learn Today
Flexbox Architecture 2: Align-Items, Flex-Wrap & Responsive Cards — Comprehensive Practical Guide
Har concept ko visual mental models, code anatomy aur practical industry tips ke sath samjhein.
While justify-content aligns items horizontally, `align-items` aligns them vertically along the cross axis, and `flex-wrap` allows items to drop down to new lines when container space runs out.
"Imagine words wrapping in a paragraph when you hit the right margin of a page. flex-wrap: wrap does that for cards!"
👨🏫3. Teacher Demonstration Code
Cards expand equally with flex: 1 and wrap onto new lines on smaller screens.
<style>
.card-grid {
display: flex;
flex-wrap: wrap;
gap: 16px;
align-items: stretch;
}
.card {
flex: 1 1 250px; /* grow, shrink, min-width 250px */
padding: 20px;
background: #ffffff;
border: 1px solid #e2e8f0;
border-radius: 12px;
}
</style>
<div class="card-grid">
<div class="card"><h3>Feature 1</h3><p>Fast coding compiler.</p></div>
<div class="card"><h3>Feature 2</h3><p>Live GitHub grading.</p></div>
<div class="card"><h3>Feature 3</h3><p>Oral viva simulator.</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 15 Practical Task Test Studio
Add `display: flex;` and `flex-wrap: wrap;` to .showcase-container.
Add `align-items: center;` and `gap: 16px;` to .showcase-container.
Spot the Bug: Cards Squished to Unreadable Thin Strips
Tap or click on the exact line below that contains the error:
Click any code line.gallery { display: flex; gap: 20px; /* Missing flex-wrap forces 10 wide cards into a single tiny line! */}.gallery-item { width: 300px;}Senior Developer Forensic Analysis:
By default, flex-wrap is nowrap. Flexbox shrinks all children to prevent breaking into new lines, squishing cards into unreadable thin slivers.
📝Independent Practice: Assignment
📄 pricing-cards.htmlHomework Task: BCA 6-Semester Roadmap Cards
- •Create folder `day-15` with `index.html`.
- •Build a container with 6 cards representing Semesters 1 through 6.
- •Use `display: flex; flex-wrap: wrap; gap: 16px;` with cards sized at `flex: 1 1 280px;`.
- •Inspect how resizing the browser window causes 3 columns -> 2 columns -> 1 column smoothly.
Open Visual Studio Code on your PC (code .), create pricing-cards.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 15 - Flexbox Responsive Pricing Cards</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Segoe UI', Tahoma, sans-serif;
background: #0b1120;
color: white;
padding: 40px 16px;
}
.container {
max-width: 980px;
margin: 0 auto;
text-align: center;
}
h1 { font-size: 26px; color: #38bdf8; margin-bottom: 8px; }
.subtitle { color: #94a3b8; font-size: 14px; margin-bottom: 36px; }
/* Flexbox Container with flex-wrap and align-items: stretch */
.card-deck {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 24px;
align-items: stretch;
}
.card {
flex: 1 1 280px;
max-width: 320px;
background: #1e293b;
border: 1px solid #334155;
border-radius: 16px;
padding: 28px;
display: flex;
flex-direction: column;
justify-content: space-between;
text-align: left;
transition: transform 0.25s ease, border-color 0.25s ease;
}
.card:hover {
transform: translateY(-6px);
border-color: #38bdf8;
}
.card.featured {
border: 2px solid #2563eb;
background: #172554;
}
.badge {
display: inline-block;
padding: 4px 10px;
border-radius: 50px;
font-size: 11px;
font-weight: bold;
background: #2563eb;
color: white;
margin-bottom: 12px;
}
.tier-name { font-size: 20px; font-weight: bold; margin-bottom: 6px; }
.price { font-size: 28px; font-weight: 800; color: #38bdf8; margin-bottom: 16px; }
.price span { font-size: 13px; color: #94a3b8; font-weight: normal; }
.features { list-style: none; margin-bottom: 24px; flex-grow: 1; }
.features li { font-size: 13px; color: #cbd5e1; margin-bottom: 8px; }
.features li::before { content: "✓ "; color: #10b981; font-weight: bold; }
.btn-enroll {
width: 100%;
padding: 12px;
background: #2563eb;
border: none;
border-radius: 8px;
color: white;
font-weight: bold;
cursor: pointer;
text-align: center;
text-decoration: none;
display: block;
}
.btn-enroll:hover { background: #1d4ed8; }
</style>
</head>
<body>
<div class="container">
<h1>BCA Specialization Learning Tracks</h1>
<p class="subtitle">Equally sized cards using Flexbox flex-grow, flex-wrap, and stretch alignment.</p>
<div class="card-deck">
<div class="card">
<div>
<span class="badge">Track 1</span>
<div class="tier-name">Web Development</div>
<div class="price">Free <span>/ Semester 1</span></div>
<ul class="features">
<li>Semantic HTML5 & Modern CSS</li>
<li>CSS Grid & Flexbox Layouts</li>
<li>GitHub Pages Deployment</li>
</ul>
</div>
<a href="#enroll" class="btn-enroll">Start Practice</a>
</div>
<div class="card featured">
<div>
<span class="badge">Track 2 (Most Popular)</span>
<div class="tier-name">Full-Stack Engineer</div>
<div class="price">Free <span>/ 360 Days</span></div>
<ul class="features">
<li>JavaScript ES6+ & DOM Projects</li>
<li>React & Next.js Framework</li>
<li>Node.js & MongoDB Backend</li>
<li>Technical Viva Voce Mastery</li>
</ul>
</div>
<a href="#enroll" class="btn-enroll">Enroll Full Track</a>
</div>
<div class="card">
<div>
<span class="badge">Track 3</span>
<div class="tier-name">Systems & C++</div>
<div class="price">Free <span>/ Semester 2</span></div>
<ul class="features">
<li>Pointers & Memory Control</li>
<li>Data Structures & Algorithms</li>
<li>Object-Oriented Programming</li>
</ul>
</div>
<a href="#enroll" class="btn-enroll">Start Practice</a>
</div>
</div>
</div>
</body>
</html>🎓4. Viva Check: Mandatory Conceptual Test
Which CSS property vertically centers items in a standard horizontal (`flex-direction: row`) flex container?
5. Mandatory Step: Push to GitHub to Unlock Next Lesson
Target Repo: html-css-projects
Exact GitHub Setup Guide & Expected Structure
Day 15 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-15/ 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 15 freely! To officially submit your GitHub repository and unlock subsequent days in your portfolio, please complete Day 14: Flexbox Architecture 1: Flex Container & Justify-Content first.
Complete Day 14 First