Tutorials CSS Project: Landing Page
Ch 58 / 60
Chapter 58 Project 18 min build CSS

Project: Landing Page

This is the largest hands-on project so far — a complete, scrollable landing page assembled from five sections: a gradient hero with a two-column layout, a responsive feature grid, a testimonial card, a high-contrast call-to-action band, and a footer. Every section reuses patterns from earlier chapters (flexbox, grid, gradients, shadows, clamp() typography) combined into one cohesive page.

🚀 New course launch

Learn to code with real projects, not just theory

Build a portfolio of real-world apps while learning HTML, CSS, JavaScript and React — with mentor support every step of the way.

Why learners choose K2infocom
Everything you need to go from beginner to job-ready
Project-Based
Build 10+ real apps, not toy examples
Live Mentorship
Get unstuck fast with 1:1 support
Placement Help
Resume reviews and interview prep
★★★★★
"I went from zero coding experience to building my own portfolio site in 8 weeks. The project-based approach made everything click."
Priya Sharma
Frontend Developer, Vadodara
Ready to start building?
Join 5,000+ learners already building real projects
Enroll Now — Free Trial

↑ This is the actual finished landing page, rendered live — five sections, fully responsive.

What you'll build
Gradient hero with two-column layout
Fluid heading with clamp() typography
Responsive auto-fit feature grid
Testimonial card with avatar
High-contrast gradient CTA band
Minimal footer

Page Anatomy — 5 Sections Stacked

Every section is a self-contained, full-width block stacked vertically using normal document flow — no positioning tricks needed at the page level, just padding for vertical rhythm and a different background per section to create visual separation:

Hero gradient bg, 2-col flex layout
Features white bg, auto-fit grid
Testimonial tinted bg, centred card
CTA gradient bg, high contrast
Footer dark bg, minimal content

Step 1 — Hero Section

A flexbox row splits the hero into text (flexible) and a visual (fixed width), wrapping to a stacked column automatically once there's not enough space — no separate media query needed for that part:

CSS — hero section
.hero {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  padding:    60px 24px;
  display:    flex;
  align-items:center;
  gap:        40px;
  flex-wrap: wrap;     /* stacks to one column when space runs out */
}

.hero-text  { flex: 1; min-width: 280px; }   /* grows, but won't get TOO narrow */
.hero-visual{ flex: 0 0 320px; height: 260px; }  /* fixed size, doesn't grow/shrink */

/* ── Fluid heading — scales with viewport, bounded by clamp() ── */
.hero-title {
  color:       #fff;
  font-size:  clamp(28px, 5vw, 48px);
  font-weight:800;
  line-height:1.15;
}

/* ── Gradient text — highlight a key phrase ── */
.hero-title span {
  background:            linear-gradient(90deg, #4a8af4, #a855f7);
  -webkit-background-clip:text;
  background-clip:        text;
  color:                  transparent;   /* lets the gradient show through the text */
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-primary { background: #264de4; color: #fff; padding: 12px 24px; border-radius: 9px; }
.btn-ghost   { background: transparent; border: 1.5px solid rgba(255,255,255,.25); color: #fff; padding: 12px 24px; border-radius: 9px; }

Step 2 — Responsive Feature Grid

The same auto-fit grid pattern from the card project chapter, here applied to a row of three feature cards — works identically whether there are 3, 4, or 6 features:

3 features — wide container
card 1
card 2
card 3
Same grid — narrow container, auto-wraps
card 1
card 2
card 3
CSS — feature grid section
.features { padding: 60px 24px; background: #fff; }

.section-title { font-size: 28px; font-weight: 800; text-align: center; color: #0f172a; }
.section-sub   { font-size: 14px; color: #64748b; text-align: center; margin-bottom: 40px; }

.feature-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap:                   24px;
}

.feature-card {
  background:    #f8fafc;
  border-radius: 12px;
  padding:       28px 20px;
  text-align:    center;
  border:        1px solid #e2e8f0;
}

.feature-icon {
  width:         56px; height: 56px;
  border-radius: 14px;
  background:    rgba(38,77,228,.1);
  display:       flex; align-items: center; justify-content: center;
  margin:        0 auto 16px;
  font-size:     26px;
}

Step 3 — Testimonial Card

A single centred card sits on a tinted background — the contrast between the section background and the white card creates visual separation without needing a border, and margin: 0 auto with a max-width keeps the card from stretching edge to edge on wide screens:

CSS — testimonial section
.testimonial-section { padding: 60px 24px; background: #f0f4ff; }

.testimonial-card {
  background:    #fff;
  border-radius: 16px;
  padding:       32px;
  max-width:     560px;
  margin:        0 auto;       /* centres horizontally within the section */
  box-shadow:    0 4px 16px rgba(15,23,42,.06);
}

.testimonial-stars { color: #f59e0b; font-size: 18px; margin-bottom: 16px; }
.testimonial-quote { font-size: 16px; color: #374151; line-height: 1.6; margin-bottom: 20px; }

.testimonial-author { display: flex; align-items: center; gap: 12px; }
.testimonial-avatar {
  width:         48px; height: 48px;
  border-radius: 50%;
  background:    linear-gradient(135deg, #264de4, #a855f7);
  display:       flex; align-items: center; justify-content: center;
}

Step 4 — High-Contrast CTA Band

The CTA section needs to stop the scroll and demand attention — a saturated gradient background, generous padding, and exactly ONE button (the white pill, inverted from the blue background) make this the visual climax of the page:

CSS — call-to-action band
.cta-section {
  padding:    64px 24px;
  text-align: center;
  background: linear-gradient(135deg, #264de4, #1d3eb8);
}

.cta-title { color: #fff; font-size: 28px; font-weight: 800; margin-bottom: 10px; }
.cta-sub   { color: rgba(255,255,255,.85); font-size: 14px; margin-bottom: 26px; }

.cta-btn {
  background:    #fff;          /* INVERTED from the blue section bg — maximum contrast */
  color:         #264de4;
  padding:       14px 32px;
  border-radius: 10px;
  font-weight:   800;
  display:       inline-block;
  transition:    transform .2s;
}
.cta-btn:hover { transform: scale(1.04); }   /* subtle pop on hover, draws the eye further */

/* ── Design principle: ONE button per CTA section ──
   Multiple competing CTAs dilute the action you actually
   want the visitor to take. Secondary links, if needed,
   go in the footer — not competing for attention here. */

Page Anatomy Reference

Section Layout method Key technique
Hero Flexbox row, wraps on narrow clamp() fluid heading, gradient text via background-clip
Features CSS Grid auto-fit repeat(auto-fit, minmax()) — zero media queries
Testimonial Centred block max-width + margin:0 auto
CTA Centred text block High-contrast gradient bg, single inverted button
Footer Centred text block Low visual weight, closes the page cleanly
Free Resource
CSS3 Cheat Sheet — Landing Page Patterns
Complete reference covering hero sections, feature grids, testimonials and CTA design.
Download PDF

Try It Yourself

The complete 5-section landing page — scroll the preview to see every section, and resize the pane to test responsiveness:

Live Editor
✎ Editor
👁 Preview
Featured Course — Enroll Now
Modern Web Development With AI
Master HTML, CSS, JavaScript, React and Node.js with real projects and placement support.
120+
Chapters
40 hrs
Content
10 Real
Projects
4.9 ⭐
Rating
HTML5CSS3JavaScriptReact.jsNode.jsTailwind CSSAI Tools

Quick Check — Chapter 58

Questions & Answers
The hero uses display: flex with flex-wrap: wrap on the container, plus .hero-text { flex: 1; min-width: 280px; } and .hero-visual { flex: 0 0 320px; } on the two children.

As long as the container is wide enough to fit both the text column (at least 280px) and the visual (a fixed 320px) side by side with the gap, they sit on one row. Once the container narrows below that combined width, flex-wrap: wrap automatically pushes the visual onto a new line below the text — no breakpoint value needs to be calculated or hardcoded anywhere.

This is a "content-driven" responsive technique: the layout adapts based on whether the content actually fits, rather than at an arbitrary pixel value chosen ahead of time. It's less precise than a media query (you don't control the exact pixel where wrapping occurs) but requires far less code and adapts naturally to any combination of font size, padding, or content length changes.
Normally, a background (including a gradient) fills the entire box of an element, and any text inside sits on top of that background as a separate layer with its own color. background-clip: text changes this behaviour: instead of the background filling the whole element box, it's "clipped" to only show through the shapes of the text characters themselves — like a stencil.

However, this clipping only matters if the text's own fill colour isn't covering it up. By default, text has an opaque colour (often black or inherited), which would sit on top of the clipped background and hide it completely. Setting color: transparent removes the text's own fill, letting the gradient clipped to the letter shapes become visible through what's now invisible text.

Together, background: linear-gradient(...) + background-clip: text + color: transparent produces the gradient-filled text effect seen on the highlighted phrase in the hero heading. The -webkit- prefixed version is included for broader Safari/older-browser compatibility.
A fixed width: 540px would cause the card to overflow horizontally on any screen narrower than 540px plus its surrounding padding, forcing horizontal scrolling or causing the card to spill outside its section — a serious responsive bug.

max-width: 540px sets an upper limit but allows the card to shrink narrower when the viewport is smaller, since block-level elements default to width: auto (filling available space) unless told otherwise. So on a wide desktop screen, the card caps out at a readable 540px instead of stretching edge-to-edge looking awkwardly wide; on a narrow phone screen, it shrinks down to fit within the available width with no overflow.

margin: 0 auto only has a centring effect on block-level elements that have an explicit width (or max-width) narrower than their parent — it splits the remaining horizontal space evenly on both sides. Without a width/max-width constraint, there's no "remaining space" to split, so the two properties work together: max-width creates the boundary, and the auto margins centre the element within that boundary.
Visual hierarchy on a landing page works through contrast — if every section looked equally vivid, nothing would stand out as more important than anything else, and the visitor's eye wouldn't know where to focus or what action to take. By keeping the features and footer sections relatively neutral (white, light grey, dark navy), the CTA section's bold blue gradient creates a deliberate visual "spike" that naturally draws attention as the user scrolls toward it.

This mirrors a broader design principle: reserve your highest-contrast, most saturated colours for the ONE thing you most want the visitor to notice and act on. If the hero, features, AND the CTA were all equally colourful, the CTA would lose its special status and might get scrolled past without registering as "the moment to act."

The single white button on a blue background (rather than a blue button on a blue background, or multiple buttons) reinforces this same idea at a smaller scale — maximum contrast for the one action that matters most in that section.
Each section (.hero, .features, .testimonial-section, .cta-section, .page-footer) is a block-level element by default (whether using <section> or <footer> tags, both of which are block-level in the default browser stylesheet). Block-level elements automatically stack vertically, one below the next, in the order they appear in the HTML — this is simply normal document flow, requiring no flexbox, grid, or positioning at the page level.

Each section is also already width: 100% by default (block elements fill their parent's width unless told otherwise), so each section's own background colour or gradient naturally extends edge-to-edge of the viewport without needing a parent wrapper to enforce that width.

A wrapping container becomes necessary only when you need something that applies across ALL sections together — like a max-width constraint on the whole page, a shared padding, or if you wanted to use CSS Grid/Flexbox at the page level for some unusual non-linear arrangement. For a standard top-to-bottom scrolling landing page, the sections' natural block-level stacking is sufficient on its own.
Multiple Choice Questions
Question 1 of 5
What CSS property causes the hero's text and visual columns to stack vertically once the container becomes too narrow?
Question 2 of 5
Why is color: transparent required when using background-clip: text for gradient text?
Question 3 of 5
What combination centres the testimonial card while preventing it from overflowing on narrow screens?
Question 4 of 5
Why does the CTA section use a single white button rather than multiple competing call-to-action links?
Question 5 of 5
Why don't the five page sections need a wrapping container div to stack correctly?
Chapter Summary
  • Hero: flexbox row with flex-wrap: wrap for content-driven responsiveness, clamp() for fluid heading size, gradient text via background-clip: text + color: transparent.
  • Features: repeat(auto-fit, minmax(240px, 1fr)) grid — works identically for any number of feature cards, zero media queries.
  • Testimonial: max-width + margin: 0 auto centres a single card without overflowing on narrow screens.
  • CTA: high-contrast gradient background, single inverted-colour button — visual hierarchy through deliberate contrast, not decoration for its own sake.
  • Footer: low visual weight, closes the page without competing with the CTA above it.
  • Page assembly: no wrapping container needed — block-level sections stack automatically in normal document flow, each full-width by default.
  • Reusable pattern: this 5-section skeleton (hero / features / social proof / CTA / footer) is the standard structure for the vast majority of real-world marketing and product landing pages.
~18 min build
Project chapter
Chapter 58 of 60

Rate Us on Google

4.8 / 5
Enjoying this tutorial?
Your 5-star review helps other learners discover our free tutorials and encourages us to keep creating quality content.
80+ reviews
Write a Google Review
Join WhatsApp Channel