Your landing page project
In this lesson, you'll build a complete landing page for a fictional SaaS product. The page will include:
- Hero section with a background gradient, centered text, and a prominent CTA button
- Features grid with 3โ4 feature cards arranged responsively
- Testimonials section with social proof cards in a flexbox row
- Pricing cards with 3 tiers, highlighting the "popular" tier with a BEM modifier
- Footer with multiple columns and links
Step 1: CSS variables foundation
Before writing any layout CSS, define your design system using CSS custom properties (variables). This keeps your page consistent and makes changes easy.
Notice how variables like --primary and --spacing-md replace hard-coded values. Now you can change the entire color scheme in one place!
Step 2: Hero section with gradient and flexbox
The hero is your page's first impression. It uses a gradient background, centered text, and a button with hover effects.
display: flex; align-items: center; justify-content: center; centers content both horizontally and vertically. The holy grail of centering!
Step 3: Features grid with CSS Grid and responsive design
Features are best shown in a grid. CSS Grid with auto-fill or auto-fit makes it responsive without media queries.
The key is grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)). This says: "Fill the grid with as many 280px-wide columns as fit, then stretch them equally." No media queries needed!
Step 4: Pricing cards with BEM modifier for "popular"
BEM (Block Element Modifier) is a naming convention that makes CSS scalable and readable. Let's use it for pricing cards.
.pricing (container), Element = .pricing__card (child), Modifier = .pricing__card--popular (variation). Naming is long but super clear!
Try it yourself: Hero + Features grid
Build the hero section and features grid. Use variables, gradient, flexbox, and CSS Grid. Click Run to see the result in real-time.
Try it yourself: Testimonials, Pricing, & Footer
Now add testimonials in a flex row, 3 pricing tiers (highlight "popular" with a BEM modifier), and a footer with columns.
Task: Take the editors above and add:
- A smooth scroll-to-section behavior when buttons or links are clicked (you can use anchor links or JavaScript)
- A responsive hamburger menu that appears on mobile (nav collapses into a toggle menu)
- Hover animations on buttons and cards (transitions, transforms, shadows)
- A newsletter signup section between testimonials and pricing
- Mobile-first responsive design with one or two breakpoints
Hint: Use scroll-behavior: smooth; on the html element for automatic scroll behavior. For the hamburger menu, hide the full nav on mobile with display: none; and show a toggle button instead. Use @media (max-width: 768px) for your breakpoint. Animations work best with transition: all 0.3s ease; on hover states.
Key patterns you learned
- CSS Variables: Define once, use everywhere. Changes cascade automatically.
- Flexbox for rows:
display: flex; gap: var(--spacing-lg);for aligned, spaced content. - CSS Grid for grids:
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));for responsive grids without media queries. - BEM naming:
.block__element--modifierkeeps CSS organized and scalable. - Hover transforms:
transform: translateY(-8px); box-shadow: 0 12px 24px rgba(...);adds depth and interactivity. - Gradients:
background: linear-gradient(135deg, color1, color2);for modern, polished backgrounds. - Responsive design: Use
clamp()for responsive fonts and grid auto-fit for flexible layouts.
Test your knowledge
What's next?
Next lesson: Build a Portfolio Website โ โ Combine HTML & CSS to create a multi-page personal portfolio with projects, about, and contact sections.
You've now mastered responsive design, CSS Grid, Flexbox, and professional naming conventions. You're ready to tackle real-world projects!
You just built a professional landing page.
Next stop: full-stack web development.
Join the Best AI Programs โ three 5-month courses, fully online, with placement assistance. Week 1 is free.
Explore our AI-era courses โ