Lesson 13 / Design

Hero Sections

Time
45 min
Type
Reading + Practice
Level
Intermediate
Use
Core

Design responsive hero sections that make a strong first impression, communicate a clear message, and guide users toward action.

Course Role

Core

Part of the main course path. Prioritize this before moving to optional polish or deeper references.

Teacher Notes / In-Class Use

Demo Live

  • Model the core workflow from the lesson using a small class example.
  • Connect the example back to the first goal: Understand why above-the-fold content still matters

Try In Class

  • Build a responsive hero section with a hero image, headline, supporting text, and CTA.
  • Have students make one visible change, save, refresh, and explain what changed.

Submit Or Check

  • Ask students to show the work in the browser, not only in the editor.
  • Have students commit their progress with a clear message when the checkpoint is stable.

Watch For

  • Students copying code without checking file paths, spelling, or capitalization.
  • Visual changes that work locally but break when the project is published.

Learning Goals

  • Understand why above-the-fold content still matters
  • Identify the key elements of a compelling hero section
  • Build a responsive hero section with fluid layout and adaptable typography

What This Teaches

A hero section is the first major section of a page. It should quickly communicate what the page is about, why it matters, and what the visitor can do next.

This lesson teaches how to plan and build a responsive hero section with clear content, a meaningful visual, and a strong call to action.

You will focus on structure, hierarchy, responsive layout, accessibility, and performance.

Above the Fold, Without Cramming

The fold is the part of a page visible before scrolling. It matters because it shapes the first impression, but it is not a fixed pixel line.

The first viewport should establish purpose and direction. It is okay if the next section is partially visible, and it is usually better than cramming everything into one screen.

Mobile screens, browser chrome, zoom settings, and device sizes all change where the fold appears.

Hero Section Anatomy

PartPurpose
HeadlineNames the offer, project, product, place, or main idea clearly.
Supporting copyAdds context without repeating the headline.
Primary CTAGives the visitor one obvious next action.
Visual mediaShows the product, project, mood, or subject when it helps understanding.
Secondary CTAOffers a lower-priority alternative, such as learning more.
Trust cue or contextAdds useful evidence, metadata, category, or audience context.

Designing the First Viewport

  • Make the headline specific. Avoid vague lines like "Welcome to my website."
  • Keep supporting copy short enough to scan.
  • Make the primary CTA visually obvious.
  • Leave enough space around text so the hero does not feel cramped.
  • Let the next section peek into view when possible so the page invites scrolling.

CTA Guidance

A CTA, or call to action, should say what happens next. For navigation actions, use an a element instead of a button.

Weak CTAStronger CTA
Click hereView Projects
Learn moreExplore the Case Study
SubmitRequest a Quote
GoStart Planning

Mobile-First Hero HTML

Start with semantic HTML. Keep important text as real text, not baked into an image.

<section class="hero">
  <div class="hero__content">
    <p class="hero__eyebrow">Portfolio</p>
    <h1>Designing useful websites for local creative businesses</h1>
    <p>
      I build responsive sites that pair clear content with thoughtful visual design.
    </p>
    <a class="button" href="#projects">View Projects</a>
  </div>

  <img
    class="hero__image"
    src="studio-work.jpg"
    alt="Laptop showing a portfolio website layout on a desk"
  >
</section>

Mobile-First Hero CSS

The base styles work for small screens first. The larger-screen media query adds the two-column layout.

.hero {
  display: grid;
  gap: 2rem;
  padding-block: 4rem;
  padding-inline: 1rem;
}

.hero__content {
  max-width: 42rem;
}

.hero__image {
  border-radius: 8px;
  height: auto;
  width: 100%;
}

@media (min-width: 768px) {
  .hero {
    align-items: center;
    grid-template-columns: 1fr 1fr;
    padding-block: 6rem;
  }
}

Hero Layout Patterns

PatternUse When
Stacked heroThe page needs a simple headline, copy, CTA, and visual that stack naturally on mobile.
Two-column heroThe visual and copy are equally important on wider screens.
Image-background heroThe image is decorative and text contrast can stay readable.
Editorial heroThe page needs a strong headline and supporting metadata more than a product-style CTA.
Product heroThe page needs to show the product clearly in the first viewport.

Responsive Typography

Hero headlines can be larger than body text, but they still need controlled line length and readable wrapping.

.hero h1 {
  font-size: 2.5rem;
  line-height: 1.2;
  max-width: 12ch;
}

@media (min-width: 768px) {
  .hero h1 {
    font-size: 4rem;
  }
}

Hero Images and Backgrounds

Choose media based on meaning. If the image communicates important content, use an img element with useful alt text.

If the image is purely decorative, a CSS background-image can be appropriate.

  • Do not put important words inside an image.
  • Do not rely on a background image if the user needs to understand the image content.
  • Check text contrast when text sits over an image.
  • Avoid distorted images by using width: 100%, height: auto, or object-fit: cover when cropping is intentional.

Accessibility Checklist

  • Use one clear h1 for the page topic.
  • Use descriptive CTA text, not "Click here."
  • Use a real link for navigation CTAs and a real button for actions that happen on the page.
  • Write meaningful alt text for meaningful images.
  • Keep text contrast readable over images and color backgrounds.
  • Do not rely only on motion, video, or color to communicate meaning.
  • Provide captions or transcripts when video content is meaningful.

Performance Checklist

  • Compress hero images before adding them to the site.
  • Use image dimensions close to the size needed in the layout.
  • Consider modern formats like WebP.
  • Avoid enormous images that slow down the first page load.
  • Do not lazy-load the primary above-the-fold hero image if it is important to the first render.
  • Avoid autoplaying heavy video unless it is essential and optimized.

Study Real Hero Sections

When studying real examples, do not just copy the look. Ask what the hero is doing.

  • What is the page about?
  • What is the main visual signal?
  • What is the primary CTA?
  • What changes between mobile and desktop?
  • Is the text readable over the image or background?
  • Does the first viewport invite scrolling?
Stripe hero section with a large headline, colorful background, payment form, and dashboard interface.
Stripe pairs a specific headline with product-interface visuals that show what the service does.
Samsung hero section with large sale alert copy, a CTA, and promotional product imagery.
Samsung uses a simple split layout: clear offer on one side, product and sale context on the other.
Apple iPhone hero section with product closeup, compact headline, and two calls to action.
Apple makes the product the visual signal and keeps the copy short, centered, and action-oriented.
Nickelodeon games hero section with character artwork, playful typography, and a play now call to action.
Nickelodeon leans into mood and audience: playful visuals, high energy, and a direct action.
Tekken 8 hero section with dramatic game art, review scores, and a buy now call to action.
Tekken uses cinematic art, social proof, and a high-contrast CTA to create urgency.

Common Mistakes

MistakeWhy it hurtsFix
Vague headlineVisitors do not know what the page offers.Name the product, project, service, or topic clearly.
CTA looks like normal textThe next action is easy to miss.Style the primary CTA as a clear link/button.
Low contrast over imageText becomes hard to read.Add a stronger overlay, move the text, or choose a calmer image.
Image distorts on mobileThe page feels unpolished.Use flexible image sizing and intentional cropping.
Hero is too tallUsers cannot see what comes next.Reduce padding or let the next section peek into view.
Important content hidden on mobileSmall-screen users miss key information.Prioritize and simplify instead of removing meaning.

Code Challenge: Build Your Own Responsive Hero Section

Create a hero section for a fictional website or your own portfolio. Include a headline, supporting text, a primary CTA, and a meaningful visual.

Build mobile-first, then add a larger-screen layout with @media (min-width: ...).

Checkpoint

Before moving on, make sure these feel true.

  • I can explain the main concept in my own words.
  • I can apply this lesson to my current project.
  • I can verify the result in the browser.
  • I can commit the change with a clear message.

Practice

  • Build a responsive hero section with a hero image, headline, supporting text, and CTA.
  • Write three specific hero headline options before choosing one.
  • Use an a element for a navigation CTA such as View Projects.
  • Build the hero mobile-first, then add a two-column layout at a wider screen size.
  • Add a responsive image with meaningful alt text.
  • Check the hero at 320px, tablet width, and desktop width.
  • Check text contrast over any image or colored background.
  • Make sure the hero does not hide all following content on mobile.
  • Compress the hero image and confirm it is not oversized for the layout.