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.
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.
↑ This is the actual finished landing page, rendered live — five sections, fully responsive.
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:
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:
.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:
.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:
.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:
.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 |
Try It Yourself
The complete 5-section landing page — scroll the preview to see every section, and resize the pane to test responsiveness:
Quick Check — Chapter 58
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.
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.
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.
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.
.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.
-
Hero: flexbox row with
flex-wrap: wrapfor content-driven responsiveness,clamp()for fluid heading size, gradient text viabackground-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 autocentres 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.
Rate Us on Google
Join Our Learning Community
Connect with thousands of learners, get daily tips, ask questions and stay updated with new tutorials.