Intermediate project: build a responsive landing page
Build a complete mobile-first landing page with a hero, responsive grids, cards, a call to action and a footer.
In this lesson you will
- Plan and build a full landing page
- Use grids, flexbox and media queries together
- Reuse components with classes
- Test across widths and with the keyboard
About 22 minutes
Your second CSS project: a landing page
A landing page has one job: persuade a visitor to do one thing. Sign up, buy, book, start a course. Designers and developers build them constantly for businesses, so being able to produce a clean, responsive one is a very marketable skill. In this project you will build a landing page for a fictional course site using everything from the intermediate lessons: flexbox, grid, positioning, media queries, mobile-first thinking and cards.
What you will build
- A sticky header with a logo and a responsive menu.
- A hero section with a headline, a short paragraph and two buttons.
- A features section with a responsive grid of icon cards.
- A course section with cards that fit one, two or three across.
- A call-to-action band and a footer in columns.
- A layout that works from 360 pixels up to a wide desktop.
Step 1: HTML skeleton
<header class="site-header">...</header>
<main>
<section class="hero">
<div class="container">
<h1>Learn skills that pay, in minutes a day</h1>
<p>Free, short lessons with quizzes. Start today.</p>
<div class="actions">
<a class="btn btn-primary" href="#courses">Browse courses</a>
<a class="btn btn-ghost" href="#features">How it works</a>
</div>
</div>
</section>
<section id="features" class="section">
<div class="container">
<h2>Why learners love it</h2>
<div class="grid"> <article class="feature">...</article> ... </div>
</div>
</section>
<section id="courses" class="section alt">
<div class="container">
<h2>Popular courses</h2>
<div class="grid"> <article class="card">...</article> ... </div>
</div>
</section>
<section class="cta">...</section>
</main>
<footer class="site-footer">...</footer>
Always do the HTML first, in reading order, using the semantic elements you know. Then the CSS has a clean skeleton to dress.
Step 2: base styles and tokens
*, *::before, *::after { box-sizing: border-box; }
:root {
--violet: #5A28C8;
--ink: #14112E;
--soft: #F7F5FF;
}
body { margin: 0; font-family: "Manrope", Arial, sans-serif; line-height: 1.65; color: var(--ink); }
img { max-width: 100%; height: auto; display: block; }
.container { width: min(100% - 2rem, 1100px); margin-inline: auto; }
.section { padding-block: clamp(2.5rem, 6vw, 5rem); }
.section.alt { background: var(--soft); }
h1, h2, h3 { line-height: 1.15; }
h1 { font-size: clamp(2rem, 1.2rem + 4vw, 3.6rem); }
h2 { font-size: clamp(1.5rem, 1rem + 2vw, 2.2rem); }
A small set of variables, the --violet style names, holds your palette in one place. Change a value once and the whole page updates. You will study custom properties properly in the advanced lessons, but they are easy to use already: define in :root, use with var(--name).
Step 3: the hero and buttons
.hero {
background: linear-gradient(135deg, #6C2BE0, #4A6EDD);
color: #fff;
padding-block: clamp(3rem, 9vw, 7rem);
text-align: center;
}
.hero p { max-width: 52ch; margin: 1rem auto 2rem; opacity: .92; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.btn { display: inline-block; padding: .85rem 1.6rem; border-radius: 999px; font-weight: 700; text-decoration: none; transition: transform .2s, background .2s; }
.btn-primary { background: #fff; color: var(--violet); }
.btn-ghost { border: 2px solid rgba(255,255,255,.7); color: #fff; }
.btn:hover { transform: translateY(-2px); }
Style a hero: a violet-to-blue gradient background, white centred text, generous padding, and two buttons in a wrapping flex row with a 12px gap.
<style>
body { margin:0; font-family: Arial; }
.hero { /* gradient hero */ }
.actions { /* flex row */ }
.btn { display:inline-block; padding:10px 20px; border-radius:999px; text-decoration:none; font-weight:700; }
.p { background:#fff; color:#5A28C8; } .g { border:2px solid #fff; color:#fff; }
</style>
<section class="hero"><h1>Learn skills in minutes</h1><p>Free lessons with quizzes.</p><div class="actions"><a class="btn p" href="#">Browse</a><a class="btn g" href="#">How it works</a></div></section>
.hero{background:linear-gradient(135deg,#6C2BE0,#4A6EDD);color:#fff;text-align:center;padding:48px 20px;} .actions{display:flex;flex-wrap:wrap;justify-content:center;gap:12px;}
<style>
body { margin:0; font-family: Arial; }
.hero { background:linear-gradient(135deg,#6C2BE0,#4A6EDD); color:#fff; text-align:center; padding:48px 20px; }
.actions { display:flex; flex-wrap:wrap; justify-content:center; gap:12px; }
.btn { display:inline-block; padding:10px 20px; border-radius:999px; text-decoration:none; font-weight:700; }
.p { background:#fff; color:#5A28C8; } .g { border:2px solid #fff; color:#fff; }
</style>
<section class="hero"><h1>Learn skills in minutes</h1><p>Free lessons with quizzes.</p><div class="actions"><a class="btn p" href="#">Browse</a><a class="btn g" href="#">How it works</a></div></section>
Step 4: grids for features and courses
.grid { display: grid; gap: 20px; margin-top: 2rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.feature { background: #fff; padding: 24px; border-radius: 16px; box-shadow: 0 6px 20px rgba(20,17,46,.07); }
.feature .icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: #EFEAFD; color: var(--violet); margin-bottom: 12px; font-weight: 800; }
The same .grid class powers both the feature cards and the course cards. That is reuse: you wrote it once. The course cards come from the previous lesson, so paste them in.
Step 5: call to action and footer
.cta { background: var(--ink); color: #fff; text-align: center; padding-block: 4rem; }
.site-footer { background: #0D0B1F; color: #B9B5D6; padding-block: 2.5rem; }
.footer-grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
Step 6: review checklist
- Open responsive mode and drag from 320 to 1400 pixels. Does anything overflow, cramp or look lonely?
- Tab through the page. Is every link and button clearly focused?
- Check contrast of the white text on the gradient and of the small grey footer text.
- Check that images have width, height and meaningful alt text, or empty alt if decorative.
- Run Lighthouse in the developer tools and look at accessibility and performance.
- Validate your CSS and HTML.
Stretch goals
- Add a dark mode with
prefers-color-schemeby redefining your variables. - Add a sticky header with a blurred background using
backdrop-filter. - Add a testimonials section using a three-column grid that becomes one column on phones.
- Add smooth scrolling with
html { scroll-behavior: smooth; }and make the hero buttons jump to sections. - Publish the page for free and show it in your portfolio.
Create the footer grid: one column by default, and at 400px and wider three columns of 2fr 1fr 1fr with a 16px gap.
<style>
body { margin:0; font-family: Arial; }
footer { background:#0D0B1F; color:#B9B5D6; padding:24px; }
.fg { /* grid */ }
</style>
<footer><div class="fg"><div><strong style="color:#fff">Skills in Minutes</strong><p>Free learning.</p></div><div>Courses</div><div>Company</div></div></footer>
.fg{display:grid;gap:16px;grid-template-columns:1fr;} @media (min-width:400px){ .fg{grid-template-columns:2fr 1fr 1fr;} }
<style>
body { margin:0; font-family: Arial; }
footer { background:#0D0B1F; color:#B9B5D6; padding:24px; }
.fg { display:grid; gap:16px; grid-template-columns:1fr; }
@media (min-width:400px){ .fg { grid-template-columns:2fr 1fr 1fr; } }
</style>
<footer><div class="fg"><div><strong style="color:#fff">Skills in Minutes</strong><p>Free learning.</p></div><div>Courses</div><div>Company</div></div></footer>
Send the link to three people and ask them one question: what do you think this page wants you to do? If they answer correctly in five seconds, your landing page is doing its job.
Check what you learned
Five quick questions. Pick an answer and you will see straight away whether it is right and why.
What is the main goal of a landing page?
- To show every page of the site
- To persuade visitors to do one thing
- To list all links
- To play music
A landing page focuses on one action.
Why write the HTML first?
- It is required
- A clean semantic skeleton makes the CSS easier
- CSS cannot run first
- It saves bandwidth
Structure first, then style.
Which layout rule makes a footer one column on phones and three on desktop?
- Only max-width queries
- A mobile-first grid with a min-width media query
- Absolute positioning
- Floats
Define one column, then add columns at a breakpoint.
What do CSS variables like --violet give you?
- Faster images
- One place to change a colour for the whole page
- Better SEO
- A new font
Change it once and everything using it updates.
What is a good final review step?
- Skip testing
- Drag from 320px to wide, Tab through, check contrast and run Lighthouse
- Only check on one device
- Trust the editor
Real checks catch real problems.
Summary
- Write semantic HTML first, then style it mobile-first.
- One grid class can serve several sections.
- Custom properties keep the palette in one place.
- Review at many widths, with the keyboard, and with Lighthouse.
Questions
Can I use my own business idea?
Yes. Swap the content and colours. The structure works for any product or service.
Do I need images for the cards?
No. Coloured blocks or icons work. Real images look best.
Where do I go next?
The advanced lessons cover transitions, transforms, animations, custom properties, modern selectors and a professional workflow.
