Thuta Learning
HTML
ProjectsWeb DevelopmentBeginner

Project 2: Landing Section

HTMLLesson 3445 min

What you'll walk away with

  • Write the document shell (lang, viewport, title) and the header/nav/main landmarks
  • Add a skip link and check that every in-page link has a matching target id
  • State the value proposition in a single h1 and give every section an h2
  • Choose <a> for navigation and <button> for actions when writing CTAs
  • Add the hero image with width/height and alt, without lazy loading

Explain it simply

Explain it simply

A landing page is the page people reach first from an ad or a search result. The hero section is its top part, the first thing visitors see, and within seconds it must answer three questions: what is this, what is in it for me, and what do I do next?

Think of a shop's front sign. It needs the shop name (the logo), what it sells (the h1), a short explanation (a paragraph) and a door that says "come in" (the CTA link). In this project you build those parts with semantic HTML and connect them to features, pricing and contact sections.

Problem → Why → Solution

The problem: a hero that looks good and says nothing

Look at a hero copied quickly from a design file. The headline is big, but it is a <div>, and the "Start building" button is a <div> with an onclick. The navigation points at #pricing and #contact, but no element on the page has those ids.

It looks fine to a mouse user, but a keyboard user can never Tab to the CTA. A screen reader user who jumps to the h1 finds no heading at all and cannot tell what the page is about, and a search engine has to guess the page's main topic. Every visitor who clicks "Pricing" sees nothing happen and leaves.

index.html
<nav>
  <a href="#features">Features</a>
  <a href="#pricing">Pricing</a>   <!-- no element has id="pricing" -->
</nav>
<div class="hero">
  <div class="big-title">Build AI-powered workflows faster</div>
  <div class="btn" onclick="location.href='/signup'">Start building</div>
</div>

Why this happens

A <div> provides only appearance: no meaning, no focus and no keyboard behaviour. The h1 is what tells browsers, assistive technology and search engines the page's topic, and <a href> is what takes focus and responds to Enter. An in-page link whose target id is missing does nothing and shows no error.

Core concept: five layers of a landing section

You can think of a landing page as five layers stacked on each other. Each layer answers one question, and if one is missing the page fails no matter how good the design looks.

1. The document shell

<html lang="en"> lets screen readers choose the right pronunciation. The viewport meta stops phones from shrinking a desktop-sized layout. <title> appears in the browser tab and in search results, so state the product name and its benefit clearly.

2. Landmarks and a skip link

<header>, <nav> and <main> are landmarks that assistive technology can jump between. The first link on the page is "Skip to main content", pointing at <main id="main">, so keyboard users do not have to Tab through the navigation on every page.

3. One h1 and a heading outline

The hero's h1 is the value proposition: write the benefit the visitor gets, not "Welcome". Each section (Features, Pricing, Contact) gets an h2, so the outline reads like the page's table of contents.

4. CTAs: link or button

Going to another page or section is <a href>; doing something on the page, such as submitting a form or opening a menu, is <button>. Separate the primary CTA ("Start building free") from the secondary one ("See the features") by their text, and never use words like "Click here".

5. The hero image

The hero image is often the largest element on the page, so it must appear quickly: give it width/height and do not add loading="lazy". If it is a screenshot, the alt says what it shows; if it is a purely decorative background, use alt="".

What the CTA doesElement
Goes to the sign-up page<a href="/signup">
Jumps to a section on the page<a href="#features">
Submits an email subscribe form<button type="submit">
Opens the mobile menu<button type="button">
The visitor's first five seconds
  1. Tab title: where am I?
  2. h1: what is this, why care?
  3. Paragraph: how does it help?
  4. CTA: what do I do next?

If the page reads in this order with CSS switched off, the structure is right; mobile layout and keyboard order follow the same source order.

General pattern

html
<a href="#main">Skip to main content</a>
<header>logo link + <nav aria-label="...">links</nav></header>
<main id="main">
  <section class="hero">
    <h1>Benefit-focused headline</h1>
    <p>One or two sentences of support</p>
    <a href="/next-step">Primary action</a>
  </section>
  <section id="topic"><h2>Topic</h2> ... </section>
</main>

Order it as skip link, header/nav, main, hero (h1 + p + CTA), then h2 sections. Every in-page link needs a matching id.

The Draftflow landing page

This is the complete landing page: the document shell, a skip link, the hero and feature sections, the Pricing and Contact sections, two CTAs and a hero image. Check that every nav link points at a section id that really exists on the page; a link to a missing section silently does nothing. dashboard-preview.png is a placeholder, and "Draftflow" is a made-up product name for practice.

index.html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Draftflow: AI content workflows</title>
</head>
<body>
  <a href="#main">Skip to main content</a>
  <header>
    <a href="/">Draftflow</a>
    <nav aria-label="Main navigation">
      <ul>
        <li><a href="#features">Features</a></li>
        <li><a href="#pricing">Pricing</a></li>
        <li><a href="#contact">Contact</a></li>
      </ul>
    </nav>
  </header>

  <main id="main">
    <section class="hero">
      <h1>Build AI-powered workflows faster</h1>
      <p>Create, automate and manage your content workflow from one dashboard.</p>
      <p>
        <a href="/signup">Start building free</a>
        <a href="#features">See the features</a>
      </p>
      <img src="dashboard-preview.png" width="1200" height="675"
           alt="Draftflow dashboard with three automated workflows">
    </section>

    <section id="features">
      <h2>Key features</h2>
      <ul>
        <li>AI writing assistant</li>
        <li>Automation workflow builder</li>
        <li>Project dashboard</li>
      </ul>
    </section>

    <section id="pricing">
      <h2>Pricing</h2>
      <p>Free for three workflows. Pro costs $12 per month.</p>
    </section>

    <section id="contact">
      <h2>Contact</h2>
      <p><a href="mailto:hello@example.com">Email the Draftflow team</a></p>
    </section>
  </main>
</body>
</html>

Code breakdown

  1. Skip link first<a href="#main">Skip to main content</a>

    This is the first Tab stop on the page. Pressing Enter skips the navigation and lands on <main id="main">. CSS usually hides it until it receives focus.

  2. Named navigation landmark<nav aria-label="Main navigation">

    aria-label tells this nav apart from any other nav on the page, such as a footer nav. The links sit in a <ul>, so a screen reader announces "list, 3 items".

  3. The value proposition<h1>Build AI-powered workflows faster</h1>

    The only h1 on the page. It states the visitor's benefit rather than just the product name, which makes the topic clear to search engines and screen readers alike.

  4. Primary CTA is a link<a href="/signup">Start building free</a>

    It goes to the sign-up page, which is navigation, so it is <a href> rather than <button>. The text names the action and the fact that it is free, so people know what will happen.

  5. Hero image without lazy loading<img src="dashboard-preview.png" width="1200" height="675"

    width/height fix the 16:9 ratio up front so the layout does not jump. It is visible immediately, so it deliberately has no loading="lazy".

  6. A real target for the nav link<section id="pricing">

    The nav's href="#pricing" looks for this id. The id and the href must match exactly, including letter case.

You should see
Without CSS it reads top to bottom: the "Skip to main content" link, the "Draftflow" link, a Features/Pricing/Contact bullet list, the large h1 "Build AI-powered workflows faster", the supporting sentence, the two links "Start building free" and "See the features", the image area (alt text while the image is missing), then the Key features, Pricing and Contact h2 sections. The tab reads "Draftflow: AI content workflows", and every nav link jumps to its section.

Making the hero image faster

When landing page speed is measured, the metric people watch most is Largest Contentful Paint (LCP): when the biggest element appears. The hero image is often that element, so use srcset/sizes from the Responsive Images lesson to send phones a smaller file. fetchpriority="high" hints that the browser should download this image early; it is only a hint, not a guarantee.

html
<img src="dashboard-1200.png"
     srcset="dashboard-600.png 600w, dashboard-1200.png 1200w"
     sizes="(max-width: 700px) 100vw, 1200px"
     width="1200" height="675" fetchpriority="high"
     alt="Draftflow dashboard with three automated workflows">

In real projects

In real projects

Startups, online courses and app launches often build a separate landing page for each ad campaign. Marketing teams A/B test the h1 and the CTA text to see which wording brings more sign-ups, so the HTML structure has to be solid while the words stay easy to swap.

Before launch, teams run a checklist: can the Tab key alone go from the skip link to the CTA, does every nav link have a target, is the h1 readable at a 320px phone width, does the alt text still carry the meaning if the image fails, and is LCP good in Lighthouse? The <title> and meta description that appear in search results are written specifically for each page, as in the SEO lesson.

Common mistakes

Common mistakes

In-page links with no target

Writing href="#pricing" and giving the section id="Pricing" (capital P) means clicking does nothing. The browser shows no error, so click every nav link yourself.

Using <button> for navigation

<button onclick="location.href='/signup'"> cannot be middle-clicked into a new tab or copied as a link, and screen readers announce a button, so nobody expects a page change. If it changes the page, it is <a href>.

Lazy-loading the hero image

loading="lazy" often gets pasted everywhere, but on the first visible image it makes the browser wait for layout before downloading, which slows LCP. Use lazy only for images further down the page.

Spending the h1 on the logo

Making the logo the h1 on every page leaves every page's h1 as "Draftflow", which says nothing about each page's topic. Keep the logo a link and use the h1 for the page's main message.

Mini challenge

A landing section for a language school

Build a landing page for a "Speak English in 12 weeks" course. The hero needs an h1, supporting text, a primary CTA linking to the enrolment page and a secondary CTA linking to the schedule section on the page. Add an email subscribe form as well.

  • Include lang, the viewport meta and a <title> that describes the course
  • Include a skip link and a nav with aria-label; every in-page link has a matching id
  • Exactly one h1, with h2 headings for the Schedule and Stay updated sections
  • Both CTAs are <a>, the subscribe form submits with a <button>, and the email input has a label
course.html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <!-- TODO: viewport meta and a descriptive <title> -->
</head>
<body>
  <!-- TODO: skip link to #main -->
  <header>
    <!-- TODO: logo link + nav (aria-label) linking to #schedule and #updates -->
  </header>
  <main id="main">
    <!-- TODO: hero: h1, one supporting sentence, -->
    <!--   primary CTA -> /enrol, secondary CTA -> #schedule -->

    <!-- TODO: section#schedule with an h2 and a list of class times -->

    <!-- TODO: section#updates with an h2 and a subscribe form: -->
    <!--   labelled email input + submit button -->
  </main>
</body>
</html>

Expected: The browser tab shows the course name, and the page shows the skip link, logo, nav, h1, supporting sentence, two CTA links, the Schedule section with its class times and a subscribe form with an "Email address" label. "See the schedule" and the nav links jump to their sections, and Tab moves in order from the skip link to the Subscribe button.

Show hint

Write each matching id as soon as you write its href; the form's <label for> and <input id> must match too. When you are done, walk through the whole page using only the Tab key.

Show solution
course.html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Speak English in 12 weeks | Evening course in Yangon</title>
</head>
<body>
  <a href="#main">Skip to main content</a>
  <header>
    <a href="/">Bright English School</a>
    <nav aria-label="Main navigation">
      <ul>
        <li><a href="#schedule">Schedule</a></li>
        <li><a href="#updates">Updates</a></li>
      </ul>
    </nav>
  </header>

  <main id="main">
    <section class="hero">
      <h1>Speak English with confidence in 12 weeks</h1>
      <p>Small evening classes, real conversations and a teacher who knows your name.</p>
      <p>
        <a href="/enrol">Enrol for the June class</a>
        <a href="#schedule">See the schedule</a>
      </p>
    </section>

    <section id="schedule">
      <h2>Schedule</h2>
      <ul>
        <li>Monday and Wednesday, 6:30 to 8:00 pm</li>
        <li>Saturday, 9:00 to 11:00 am</li>
      </ul>
    </section>

    <section id="updates">
      <h2>Stay updated</h2>
      <form action="/subscribe" method="post">
        <label for="email">Email address</label>
        <input id="email" name="email" type="email" required>
        <button type="submit">Subscribe</button>
      </form>
    </section>
  </main>
</body>
</html>

Quick quiz 1 / 3

The hero's "Start free trial" CTA goes to the /signup page. Which markup is most appropriate?

Quick quiz 2 / 3

What does <a href="#main">Skip to main content</a> need in order to work?

Quick quiz 3 / 3

What happens if the hero image gets loading="lazy"?

What to remember

  • Check a landing page layer by layer: shell, landmarks and skip link, h1, CTAs, hero image
  • A single h1 states the value proposition, and every section gets an h2
  • Changing pages is <a href>; doing something is <button>
  • Every in-page link needs an id that matches it exactly
  • Give the hero image width/height and alt, and never lazy-load it

HTML Living Standard — WHATWG

Updated on

Progress is saved only in this browser on this device. It isn't synced to other devices.

Report a problem with this lessonOpens your email app with this lesson's address filled in — nothing is sent until you send it.

Project 2: Landing Section | Thuta Learning