Lesson 3 of 10
Hero Section & CTA
The hero section is the first thing users see - it determines whether they stay or leave. Build a full-screen hero with gradient overlay, centered content, CTA buttons, and responsive layout that looks stunning on every device.
Hero Section Elements
- Full viewport height - min-height: 100vh (or 100dvh for mobile-safe)
- Background - Gradient overlay on top of a background image for text readability
- Centered content - Flexbox centering with max-width for readable text
- Headline - Large, bold, fluid typography with clamp() for responsive sizing
- Subtitle - Lighter color, smaller font, max-width for readable line length
- CTA buttons - Primary (filled) and secondary (outlined) button pair
- Scroll indicator - Animated chevron or arrow at the bottom hinting to scroll down
Mini-Build: Hero Section
Tip
The dual-CTA button pattern (primary filled + secondary outlined) is the standard for hero sections. The filled button draws attention to the primary action, the outlined button offers an alternative without competing visually.
Crafting impactful hero sections with eye-catching typography, CTA buttons, and background gradients
Common Mistake
Using 100vh for hero height on mobile. Mobile browsers show/hide the address bar, causing content to shift. Use min-height: 100dvh (dynamic viewport height) for a hero that always fills the visible screen without being hidden behind browser chrome.
Practice Task
Improve the hero section: (1) Add a bouncing scroll indicator arrow at the bottom, (2) Make CTA buttons flex-wrap for mobile stacking, (3) Use clamp() for fluid heading and subtitle font sizes, (4) Test at 375px mobile width.
Quick Quiz
Key Takeaways
- The hero section is the first thing users see - it determines whether they stay or leave.
- Full viewport height - min-height: 100vh (or 100dvh for mobile-safe)
- Background - Gradient overlay on top of a background image for text readability
- Centered content - Flexbox centering with max-width for readable text
Finished this lesson?