Skip to content
Tutorials Center
My learning

Topics

Lesson 118 of 122 ยท Projects

Project: Responsive Landing Page

Build a complete responsive landing page with semantic HTML and CSS. Create a header, hero, features grid, pricing table, FAQ accordion, footer and media queries.

A landing page is the page people land on from an ad, a search result or a shared link. It has one job: explain a product quickly and convince the visitor to take one action, such as signing up, downloading or buying. Almost every company has dozens of them, and building one is a classic exercise because it touches nearly every part of HTML and CSS.

In this project you will build a landing page for Tidyday, a fictional daily-planner app. It has a header with navigation, a hero section with a call to action, a grid of features, a pricing comparison table, an FAQ that opens and closes, and a footer. The layout is mobile-first: it starts as a single column for phones and gains columns as the screen gets wider.

Each step below has its own editor. The final step combines everything into one complete page.

About the preview width. The previews on this page are narrow, so they usually show the phone layout. To see the wide layouts, copy the final example into a file called index.html, open it in your browser, and resize the window, or use the device toolbar in DevTools.

Step 1: Header and navigation

The page header holds the logo, the main navigation and a "Sign up" link. Before it comes a skip link: the first thing keyboard users reach when they press Tab, letting them jump past the navigation straight to the content. It stays hidden until it receives focus, as explained in Building Navigation Menus.

Step 1: header and navigation

The navigation is a list of links inside a labeled <nav>. Using flex-wrap: wrap means the links simply flow onto a second line on very narrow screens instead of overflowing, which avoids the need for a JavaScript "hamburger" menu on a short page like this.

Step 2: The hero section

The hero is the first thing visitors see. It needs a clear <h1> that says what the product does, one sentence of supporting text, a strong primary action and, optionally, a secondary one. The illustration is decorative support, but it still gets meaningful alt text because it shows what the app looks like.

Step 2: hero

Notice font-size: clamp(2rem, 6vw, 3.2rem) on the heading. The size grows with the viewport width (6vw) but never goes below 2rem or above 3.2rem, so the headline fits a phone and still looks bold on a desktop. You met clamp() in Responsive Web Design.

The two actions are links styled as buttons, because they take the visitor somewhere. If they performed an action on the page instead, they should be real <button> elements; see Links in Depth.

Step 3: The features grid

Features are a list of similar items, so mark them up as a <ul> where each <li> has a small heading and a sentence. The icons are inline SVG with aria-hidden="true": they are pure decoration, and the heading already says everything.

The layout uses one line of CSS Grid that is responsive without any media query: repeat(auto-fit, minmax(14rem, 1fr)) fits as many 14rem-wide columns as the space allows, and lets them stretch to fill the row.

Step 3: features grid

The section heading is an <h2> and each feature title is an <h3>, so the outline stays logical: the page's <h1> is in the hero. Building icons like these is covered in SVG Basics.

Step 4: The pricing table

Comparing plans across several features is genuinely tabular data: rows of features, columns of plans. That makes a real <table> the right element, with a <caption>, column headers for the plans and row headers for the features. Screen readers can then announce "Pro, Calendar sync, yes" for each cell. The Table Headers, Sections and Captions lesson covers this in detail.

Tables can be wider than a phone screen, so wrap the table in a container that scrolls sideways when needed. Give the container tabindex="0" and a label so keyboard users can scroll it too (see Styling Tables with CSS).

Step 4: pricing table

The cells say "Yes" and "No" in words. Check marks and crosses look nice, but they rely on color and symbols; if you use them, add text for screen readers too. The empty top-left cell is a <td>, not a <th>, because it isn't a header for anything.

Step 5: FAQ with details and summary

Frequently asked questions are a perfect fit for the <details> element: each question is a <summary> that opens its answer when clicked, with no JavaScript, and it works with the keyboard out of the box. Giving every <details> the same name attribute turns the group into an exclusive accordion: opening one question closes the others.

Step 5: FAQ accordion

Step 6: The complete landing page

Now everything comes together, with a sign-up section and a footer. The CSS is mobile-first: the base styles describe the single-column phone layout, and two media queries add more columns as space allows:

  • From 40rem wide, the hero places text and image side by side, and the footer spreads into columns.
  • From 60rem wide, the content gets more breathing room.

The sign-up form follows the rules from Project: Accessible Contact Form: a visible label, type="email", autocomplete and a submit handler that shows what would happen instead of sending anything.

Step 6: complete landing page

Take a moment to tour the finished page with the keyboard. The skip link appears first; every link and button shows a clear focus ring; the pricing table can be scrolled with the arrow keys once focused; the FAQ questions open with Enter or Space; and the sign-up form validates the email before the handler runs. The sign-up result is a role="status" live region, so screen readers announce the thank-you message without moving focus.

What makes it responsive

  • The viewport meta tag tells phones to use their real width instead of pretending to be a desktop.
  • width: min(100% - 2.5rem, 68rem) on .container gives a fluid width with side margins on phones and a maximum width on large screens, all in one line.
  • clamp() scales headings smoothly between a minimum and a maximum.
  • auto-fit and minmax() let the features grid choose its own number of columns.
  • flex-wrap: wrap lets the navigation, buttons and sign-up form wrap instead of overflowing.
  • Two media queries handle the changes that need a different arrangement, not just a different size.
  • img { max-width: 100%; height: auto; } stops images from ever being wider than their container, while the width and height attributes still reserve space.

Before you publish

Run through this checklist for any landing page you build:

  • One clear action. Every section should lead toward the sign-up. Keep secondary links few.
  • Headings tell the story. Read just the headings in order; they should summarize the page.
  • Contrast. Check text colors against their backgrounds, especially white text on the brand color (see Colors).
  • Performance. Give images dimensions, keep the CSS small, and avoid large scripts. Fast-Loading HTML has the details.
  • Metadata. Add social sharing previews and a favicon, since landing pages are shared constantly.
  • Validate the HTML (see Validating Your HTML) and test on a real phone.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What does "mobile-first" CSS mean?

    You start with the simplest single-column layout and layer on enhancements as space grows, using min-width queries.
  2. 2. Which CSS makes the features grid responsive without a media query?

    auto-fit with minmax() fits as many columns of at least 14rem as the space allows, and stretches them to fill the row.
  3. 3. Why is the plan comparison a real <table>?

    Tables are for data, never for layout. Here every cell is the answer to "does this plan include this feature?", which is exactly tabular data.
  4. 4. What does giving several <details> elements the same name attribute do?

    details elements that share a name form a group in which only one can be open at a time.
  5. 5. Why do the "Start free" and "See how it works" controls use <a> instead of <button>?

    Use links for navigation and buttons for actions. Styling one to look like the other doesn't change what it is.

Summary

  • A landing page explains one product and leads to one action: header, hero, features, pricing, FAQ, sign-up and footer.
  • Start with semantic landmarks, a skip link and a labeled navigation list.
  • The hero has the page's only <h1>, short supporting text and a clear call to action.
  • Use a list for features, a real <table> for plan comparisons and <details name="..."> for an FAQ accordion.
  • Build mobile-first with fluid widths, clamp(), auto-fit grids, wrapping flex rows and a couple of min-width media queries.
  • Check keyboard access, contrast, performance and metadata before publishing.

Congratulations: you have built a complete page from scratch! One more project follows before the practice chapter. Next: Project: Event Page, where you will build a page for a conference with a schedule, speakers and a registration form.