BCA Student Stories & UpdatesLive
Flexbox Architecture 1: Flex Container & Justify-Content
CSS Flexbox revolutionized web design by providing a predictable, 1-dimensional layout system that automatically distributes space and aligns items along an axis.
Day 14 Step-by-Step Practical Flow
🎯1. What You Will Learn Today
Flexbox Architecture 1: Flex Container & Justify-Content — Comprehensive Practical Guide
Har concept ko visual mental models, code anatomy aur practical industry tips ke sath samjhein.
CSS Flexbox revolutionized web design by providing a predictable, 1-dimensional layout system that automatically distributes space and aligns items along an axis.
"Imagine books on a shelf: Flexbox lets you push them to the left, center them, or spread them out with equal breathing room automatically."
👨🏫3. Teacher Demonstration Code
Logo on the left, navigation links on the right, perfectly spaced.
<style>
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 24px;
background: #000000;
color: #ffffff;
}
.nav-links {
display: flex;
gap: 16px;
}
</style>
<header class="navbar">
<div class="logo"><strong>NextSem</strong></div>
<nav class="nav-links">
<span>Lessons</span>
<span>Practicals</span>
<span>Profile</span>
</nav>
</header>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 14 Practical Task Test Studio
Add `display: flex;` and `justify-content: space-between;` to .app-header.
Add `display: flex;` and `gap: 16px;` to .header-actions.
Spot the Bug: justify-content Applied to Children Instead of Container
Tap or click on the exact line below that contains the error:
Click any code line<div class="header"> <div class="logo" style="justify-content: space-between;">Logo</div> <div class="nav">Links</div></div>Senior Developer Forensic Analysis:
justify-content is a FLEX CONTAINER property. It must be applied to the parent element (.header), not to an individual child item.
📝Independent Practice: Assignment
📄 flex-navbar.htmlHomework Task: Social Media Share Toolbar
- •Create folder `day-14` with `index.html`.
- •Create a toolbar containing 4 buttons (WhatsApp, LinkedIn, GitHub, Copy Link).
- •Use `display: flex; justify-content: center; gap: 12px;` to center all buttons perfectly.
- •Add hover background color changes to each button.
Open Visual Studio Code on your PC (code .), create flex-navbar.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 14 - Flexbox Navigation Bar</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #0b1120;
color: #f8fafc;
}
/* 1. Flexbox Navigation Header */
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 32px;
background: #1e293b;
border-bottom: 1px solid #334155;
}
.logo {
font-size: 18px;
font-weight: 800;
color: #38bdf8;
text-decoration: none;
display: flex;
align-items: center;
gap: 8px;
}
/* 2. Flex Navigation Links */
.nav-links {
display: flex;
list-style: none;
gap: 24px;
}
.nav-links a {
color: #cbd5e1;
text-decoration: none;
font-size: 14px;
font-weight: 600;
transition: color 0.2s ease;
}
.nav-links a:hover { color: #38bdf8; }
.btn-cta {
padding: 8px 18px;
background: #2563eb;
color: white;
text-decoration: none;
border-radius: 8px;
font-size: 13px;
font-weight: bold;
transition: background 0.2s ease;
}
.btn-cta:hover { background: #1d4ed8; }
.hero {
max-width: 800px;
margin: 60px auto;
text-align: center;
padding: 0 16px;
}
.hero h1 { font-size: 32px; color: white; margin-bottom: 12px; }
.hero p { color: #94a3b8; font-size: 16px; }
</style>
</head>
<body>
<nav class="navbar">
<a href="#" class="logo">🚀 BCA DevPortal</a>
<ul class="nav-links">
<li><a href="#curriculum">Curriculum</a></li>
<li><a href="#practicals">Practicals</a></li>
<li><a href="#viva">Viva Bank</a></li>
<li><a href="#github">GitHub</a></li>
</ul>
<a href="#login" class="btn-cta">Student Login</a>
</nav>
<div class="hero">
<h1>Modern CSS Flexbox Navigation</h1>
<p>Using display: flex with justify-content: space-between to evenly distribute brand logo, nav links, and CTA button.</p>
</div>
</body>
</html>🎓4. Viva Check: Mandatory Conceptual Test
What is the default direction of the main axis in a CSS Flexbox container?
5. Mandatory Step: Push to GitHub to Unlock Next Lesson
Target Repo: html-css-projects
Exact GitHub Setup Guide & Expected Structure
Day 14 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-14/ 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 14 freely! To officially submit your GitHub repository and unlock subsequent days in your portfolio, please complete Day 13: CSS Positioning: Static, Relative, Absolute & Fixed first.
Complete Day 13 First