Reading history

HTML CSS Project: Build a Responsive Landing Page

11 min read Updated 2 views

Build a complete responsive landing page with HTML and CSS: sticky header, gradient hero, auto-fit feature grid, pricing cards, FAQ accordion and SEO basics.

In this project you will build a complete, responsive landing page for “StudyDesk”, an imaginary study planner for students. A landing page has one job: explain a product quickly and lead visitors to a single action, such as signing up. The page uses only HTML and CSS, and brings together many lessons from this course: semantic structure, CSS variables, Grid and Flexbox, fluid sizes with clamp() and min(), inline SVG icons, pseudo-elements, a sticky header and a <details> FAQ.

In this project you will

  • Plan the sections of a landing page
  • Set up design tokens with CSS variables
  • Build a hero, a feature grid, pricing cards and an FAQ
  • Make the layout responsive with very few media queries
  • Check the page for accessibility and SEO basics

Complete the portfolio project first if you have not already.

Step 1: Plan the Page

Most landing pages follow the same proven order, top to bottom:

  1. Header: logo and a few links, kept visible with position: sticky.
  2. Hero: one clear headline, one sentence of explanation and a main button.
  3. Features: three short benefits, each with an icon.
  4. Pricing: plans side by side, with the recommended one highlighted.
  5. FAQ: answers to the questions that stop people signing up.
  6. Footer: copyright and small links.

Step 2: The Complete Page

Here is the full page in one file. Read it section by section with the notes below, then type it out yourself and change the product, colours and text.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>StudyDesk: Plan Your Study Week</title>
  <meta name="description" content="StudyDesk helps students plan classes, assignments and exams in one simple weekly planner.">
  <style>
    :root {
      --brand: #3949ab; --brand-dark: #283593; --accent: #ffb300;
      --text: #263238; --muted: #607d8b; --bg-soft: #f5f7fb; --radius: 12px;
    }
    * { box-sizing: border-box; }
    body { margin: 0; font-family: system-ui, sans-serif; color: var(--text); line-height: 1.5; }
    .container { width: min(100% - 32px, 960px); margin-inline: auto; }

    /* Header */
    .site-header { position: sticky; top: 0; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.08); z-index: 10; }
    .site-header .container { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; }
    .logo { font-weight: 800; font-size: 20px; color: var(--brand); text-decoration: none; }
    nav a { color: var(--text); text-decoration: none; margin-left: 16px; font-size: 15px; }
    nav a:hover { color: var(--brand); }

    /* Hero */
    .hero { background: linear-gradient(135deg, var(--brand), #5c6bc0); color: white; padding: 56px 0; text-align: center; }
    .hero h1 { font-size: clamp(28px, 6vw, 46px); line-height: 1.15; margin: 0 0 12px; }
    .hero p { font-size: clamp(16px, 2.5vw, 19px); max-width: 560px; margin: 0 auto 24px; opacity: .92; }
    .btn { display: inline-block; padding: 12px 22px; border-radius: 999px; font-weight: 700; text-decoration: none; }
    .btn-primary { background: var(--accent); color: #212121; }
    .btn-primary:hover { background: #ffca28; }
    .btn-outline { border: 2px solid currentColor; color: white; margin-left: 8px; }
    .btn:focus-visible { outline: 3px solid white; outline-offset: 3px; }

    /* Sections */
    section { padding: 48px 0; }
    section h2 { text-align: center; font-size: clamp(22px, 4vw, 30px); margin: 0 0 28px; }
    .soft { background: var(--bg-soft); }

    /* Features: auto-fitting grid */
    .features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
    .feature { background: white; border-radius: var(--radius); padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
    .feature svg { width: 32px; height: 32px; color: var(--brand); }
    .feature h3 { margin: 8px 0 4px; font-size: 18px; }
    .feature p { margin: 0; color: var(--muted); }

    /* Pricing */
    .plans { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; }
    .plan { flex: 1 1 240px; max-width: 300px; border: 2px solid #e0e0e0; border-radius: var(--radius); padding: 24px; text-align: center; }
    .plan.popular { border-color: var(--brand); position: relative; }
    .plan.popular::before { content: "Most popular"; position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
                            background: var(--brand); color: white; font-size: 12px; padding: 2px 10px; border-radius: 999px; }
    .price { font-size: 34px; font-weight: 800; margin: 6px 0; }
    .price small { font-size: 15px; color: var(--muted); font-weight: 400; }
    .plan ul { list-style: none; padding: 0; margin: 16px 0 20px; text-align: left; }
    .plan li { padding: 4px 0 4px 24px; position: relative; }
    .plan li::before { content: "\2713"; position: absolute; left: 0; color: #2e7d32; font-weight: 700; }
    .plan .btn { background: var(--brand); color: white; }
    .plan .btn:hover { background: var(--brand-dark); }

    /* FAQ */
    .faq { max-width: 640px; margin: 0 auto; }
    .faq details { background: white; border-radius: 8px; margin-bottom: 8px; padding: 12px 16px; }
    .faq summary { font-weight: 700; cursor: pointer; }

    footer { background: #263238; color: #cfd8dc; text-align: center; padding: 20px 0; font-size: 14px; }

    @media (max-width: 560px) {
      nav a:not(:last-child) { display: none; }        /* keep only the main link on phones */
      .btn-outline { margin: 10px 0 0; }
    }
  </style>
</head>
<body>
  <header class="site-header">
    <div class="container">
      <a class="logo" href="#">StudyDesk</a>
      <nav aria-label="Main">
        <a href="#features">Features</a>
        <a href="#pricing">Pricing</a>
        <a href="#faq">FAQ</a>
      </nav>
    </div>
  </header>

  <main>
    <section class="hero">
      <div class="container">
        <h1>Plan your study week in five minutes</h1>
        <p>Classes, assignments and exams in one simple planner, with reminders before every deadline.</p>
        <a class="btn btn-primary" href="#pricing">Start free</a>
        <a class="btn btn-outline" href="#features">See features</a>
      </div>
    </section>

    <section id="features" class="soft">
      <div class="container">
        <h2>Everything a student needs</h2>
        <div class="features">
          <article class="feature">
            <svg viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="5" width="18" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="2"/><path d="M3 10h18M8 3v4M16 3v4" stroke="currentColor" stroke-width="2"/></svg>
            <h3>Weekly timetable</h3>
            <p>See every class and lab for the week at a glance.</p>
          </article>
          <article class="feature">
            <svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9" fill="none" stroke="currentColor" stroke-width="2"/><path d="M12 7v5l3 3" fill="none" stroke="currentColor" stroke-width="2"/></svg>
            <h3>Deadline reminders</h3>
            <p>Get a reminder three days and one day before work is due.</p>
          </article>
          <article class="feature">
            <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 20V10M10 20V4M16 20v-7M22 20H2" fill="none" stroke="currentColor" stroke-width="2"/></svg>
            <h3>Progress charts</h3>
            <p>Track study hours per subject and spot the ones falling behind.</p>
          </article>
        </div>
      </div>
    </section>

    <section id="pricing">
      <div class="container">
        <h2>Simple pricing</h2>
        <div class="plans">
          <div class="plan">
            <h3>Free</h3>
            <p class="price">&#2547;0 <small>/ month</small></p>
            <ul><li>Weekly timetable</li><li>10 assignments</li></ul>
            <a class="btn" href="#">Choose Free</a>
          </div>
          <div class="plan popular">
            <h3>Student Plus</h3>
            <p class="price">&#2547;99 <small>/ month</small></p>
            <ul><li>Unlimited assignments</li><li>Deadline reminders</li><li>Progress charts</li></ul>
            <a class="btn" href="#">Choose Plus</a>
          </div>
        </div>
      </div>
    </section>

    <section id="faq" class="soft">
      <div class="container">
        <h2>Questions</h2>
        <div class="faq">
          <details name="q"><summary>Can I use it on my phone?</summary><p>Yes. The page adapts to any screen size.</p></details>
          <details name="q"><summary>Can I cancel any time?</summary><p>Yes, and you keep your data on the Free plan.</p></details>
        </div>
      </div>
    </section>
  </main>

  <footer>
    <div class="container">&copy; 2026 StudyDesk &middot; Made with HTML and CSS</div>
  </footer>
</body>
</html>

Result

Step 3: How It Works

  • Design tokens: the brand colours, text colours and corner radius live in :root variables. Changing --brand recolours the header logo, icons, popular plan and buttons at once.
  • Container: width: min(100% - 32px, 960px) with margin-inline: auto centers the content, keeps 16px on each side on phones, and stops at 960px on large screens.
  • Sticky header: position: sticky; top: 0 keeps the navigation visible while scrolling. z-index: 10 keeps it above the content beneath it.
  • Hero: a diagonal linear-gradient background and clamp() font sizes that scale smoothly from phone to desktop. The buttons are links styled with border-radius: 999px to make pill shapes, with a clear :focus-visible outline.
  • Feature grid: repeat(auto-fit, minmax(220px, 1fr)) fits as many 220px-wide columns as there is room for, so the cards sit three across on a laptop and stack on a phone without any media query.
  • Icons: small inline SVGs use currentColor, so they take the brand colour from .feature svg { color: var(--brand) }, and aria-hidden="true" hides them from screen readers because the headings already say everything.
  • Pricing: Flexbox with flex: 1 1 240px and flex-wrap: wrap keeps the cards side by side when there is room. The “Most popular” badge is a ::before pseudo-element centred on the top border with translateX(-50%). The tick marks are also pseudo-elements, using the escaped character \2713.
  • Prices: the taka sign is written as the entity &#2547;.
  • FAQ: <details name="q"> builds an accordion where only one answer is open at a time.
  • Single media query: below 560px, all navigation links except the last are hidden to keep the header on one line.

Step 4: Quality Checklist

CheckHow this page does it
One h1, logical headingsh1 in the hero, h2 per section, h3 per card
Landmarksheader, nav with aria-label, main, footer
Mobile readyViewport meta tag, fluid sizes, auto-fit grid
Keyboard friendlyReal links and details; visible focus outlines
SEO basicsDescriptive <title> and meta description (see meta tags)
ContrastDark text on light backgrounds; white text on the dark brand colour

Common Mistakes

  1. Too many calls to action. Give the hero one main button and make everything else lead to the same action.
  2. Vague headlines such as “Welcome to our website”. Say what the product does for the visitor.
  3. Using a <div> with a click handler as a button instead of a real link or button.
  4. Testing only on a large screen. Check the page at 360px wide in your browser’s device mode.

Extend the Project

Exercise 1. Add a third pricing plan, “Team”, that sits beside the other two on wide screens.

Show answer
<div class="plan">
  <h3>Team</h3>
  <p class="price">&#2547;299 <small>/ month</small></p>
  <ul><li>Up to 10 students</li><li>Shared calendar</li></ul>
  <a class="btn" href="#">Choose Team</a>
</div>

No CSS changes are needed: the flex rules already wrap and size the new card.

Exercise 2. Make the feature cards lift slightly when hovered.

Show answer
.feature { transition: transform .2s, box-shadow .2s; }
.feature:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .1);
}

Frequently Asked Questions

How do I make the signup button actually work?

Point it at a signup form. The form can send data to a server you write, or to a hosted form service. Collecting data safely needs a back end, which is beyond HTML and CSS.

Should the CSS stay inside the HTML file?

For a single page, a <style> block is fine. When you have several pages, move it to a styles.css file and link it from each page, so the browser downloads it once and caches it.

Summary

  • A landing page explains one product and leads to one action.
  • Variables, min() and clamp() keep the design consistent and fluid.
  • Auto-fit grids and wrapping flex rows remove most media queries.
  • Semantic HTML, focus styles and meta tags make it accessible and findable.

Next: HTML iframes: Embedding Pages, Videos and Maps.

Lessons are also marked complete when you click Next.

Leave a Reply

Your email address will not be published. Required fields are marked *