Chapter 26 of 26

Project: Build a Complete Web Page

You've learned the whole of HTML piece by piece: structure, text, links, images, lists, tables, forms, semantic elements, media, graphics, dialogs, accessibility, SEO and validation. Now it's time to put everything together and build one complete, real-world web page from an empty folder.

Our project: the official page for CodeFest 2026, an inter-college coding festival. It's the kind of page a college club actually needs, and it uses almost every topic from this tutorial. We won't write any CSS yet; the goal is a page whose HTML is correct, semantic, accessible and search-friendly. Styling comes in the CSS tutorial, and good HTML makes that part much easier.


Step 1: Plan Before You Code

Professional developers don't start by typing tags. They first decide what content the page needs and how it's organised. Our requirements:

  • The festival name, dates and venue

  • A short description with a photo

  • A schedule of events

  • A registration form

  • The rules, shown in a pop-up

  • Frequently asked questions

  • Contact details

Next, sketch a simple wireframe (a box diagram of the layout) and note which element each box will become:

┌──────────────────────────────────────────────┐
│ [logo]   About  Events  Register  FAQ        │  <header> with <svg> + <nav>
├──────────────────────────────────────────────┤
│ CodeFest 2026                                │  <main>  <h1>
│ 4–5 December 2026 · Main Auditorium          │
│                                              │
│ About the Festival                           │  <section> + <figure>
│ [ photo ]  caption, description              │
│                                              │
│ Events                                       │  <section> + <table>
│ ┌────────┬──────┬──────┬──────────┐          │
│ │ Event  │ Day  │ Time │ Team size│          │
│ └────────┴──────┴──────┴──────────┘          │
│                                              │
│ Register                                     │  <section> + <form>
│ name, email, year, events, rules [Register]  │  + <dialog> for rules
│                                              │
│ FAQ                                          │  <section> + <details>
│ ▶ question  ▶ question  ▶ question           │
├──────────────────────────────────────────────┤
│ Contact · © 2026                             │  <footer> + <address>
└──────────────────────────────────────────────┘

Doing this first means the HTML almost writes itself: every box already has a semantic element.


Step 2: Set Up the Folder

codefest/
├── index.html          ← the home page (servers load index.html by default)
└── images/
    └── hackathon.jpg   ← any photo you like, about 600 × 300 pixels

Use lowercase names with no spaces, as we discussed in HTML Best Practices & Validation. Put any photo you have in the images folder and name it hackathon.jpg.


Step 3: The Complete Code

Create index.html and type (don't just paste; typing it is how you learn) the following. We'll go through it section by section afterwards.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>CodeFest 2026 | Inter-College Coding Festival</title>
  <meta name="description" content="CodeFest 2026: a two-day coding festival with a 24-hour hackathon, a DSA contest and talks. 4–5 December 2026. Free registration for college students.">
  <link rel="canonical" href="https://codefest.example.com/">
  <meta property="og:title" content="CodeFest 2026">
  <meta property="og:description" content="Hackathon, DSA contest and talks. 4–5 December 2026.">
  <meta property="og:image" content="https://codefest.example.com/images/hackathon.jpg">
</head>
<body>
  <a href="#main">Skip to main content</a>

  <header>
    <svg width="64" height="64" viewBox="0 0 100 100" role="img" aria-label="CodeFest logo">
      <circle cx="50" cy="50" r="45" fill="navy" />
      <path d="M 30 35 L 15 50 L 30 65 M 70 35 L 85 50 L 70 65"
            fill="none" stroke="white" stroke-width="6" stroke-linecap="round" />
    </svg>
    <nav aria-label="Main">
      <ul>
        <li><a href="#about">About</a></li>
        <li><a href="#events">Events</a></li>
        <li><a href="#register">Register</a></li>
        <li><a href="#faq">FAQ</a></li>
      </ul>
    </nav>
  </header>

  <main id="main">
    <h1>CodeFest 2026</h1>
    <p><strong>4–5 December 2026</strong> · Main Auditorium, Government Engineering College</p>

    <section id="about" aria-labelledby="about-title">
      <h2 id="about-title">About the Festival</h2>
      <figure>
        <img src="images/hackathon.jpg" width="600" height="300"
             alt="Three teams of students working on laptops at long tables">
        <figcaption>Last year's hackathon had 40 teams from 12 colleges.</figcaption>
      </figure>
      <p>CodeFest is a free, student-run festival for anyone who loves to
         <em>build</em> things. Code, learn from industry speakers, and meet
         students from other colleges.</p>
    </section>

    <section id="events" aria-labelledby="events-title">
      <h2 id="events-title">Events</h2>
      <table>
        <caption>CodeFest 2026 schedule</caption>
        <thead>
          <tr>
            <th scope="col">Event</th>
            <th scope="col">Day</th>
            <th scope="col">Time</th>
            <th scope="col">Team size</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <th scope="row">24-hour Hackathon</th>
            <td>Fri–Sat</td>
            <td><time datetime="2026-12-04T10:00">10:00 AM</time> to <time datetime="2026-12-05T10:00">10:00 AM</time></td>
            <td>2–4</td>
          </tr>
          <tr>
            <th scope="row">DSA Contest</th>
            <td>Saturday</td>
            <td><time datetime="2026-12-05T11:00">11:00 AM</time> to <time datetime="2026-12-05T14:00">2:00 PM</time></td>
            <td>1</td>
          </tr>
          <tr>
            <th scope="row">Talk: Cracking Placements</th>
            <td>Saturday</td>
            <td><time datetime="2026-12-05T16:00">4:00 PM</time></td>
            <td>Open to all</td>
          </tr>
        </tbody>
      </table>
    </section>

    <section id="register" aria-labelledby="register-title">
      <h2 id="register-title">Register</h2>
      <p>Registration closes on <time datetime="2026-11-25">25 November 2026</time>.
         Fields marked (required) must be filled in.</p>

      <form action="/register" method="post">
        <p>
          <label for="name">Full name (required)</label><br>
          <input type="text" id="name" name="name" autocomplete="name" required>
        </p>
        <p>
          <label for="email">College email (required)</label><br>
          <input type="email" id="email" name="email" autocomplete="email" required>
        </p>
        <p>
          <label for="year">Year of study</label><br>
          <select id="year" name="year">
            <option value="1">1st year</option>
            <option value="2">2nd year</option>
            <option value="3">3rd year</option>
            <option value="4">4th year</option>
          </select>
        </p>
        <fieldset>
          <legend>Events you want to join</legend>
          <label><input type="checkbox" name="hackathon" value="yes"> Hackathon</label><br>
          <label><input type="checkbox" name="dsa" value="yes"> DSA Contest</label><br>
          <label><input type="checkbox" name="talk" value="yes"> Placement talk</label>
        </fieldset>
        <p>
          <label><input type="checkbox" name="rules" required> I have read the
          rules (required)</label>
          <button type="button" id="rules-btn">Read the rules</button>
        </p>
        <p><button type="submit">Register for free</button></p>
      </form>

      <dialog id="rules-dialog" aria-labelledby="rules-title">
        <h3 id="rules-title">Rules</h3>
        <ol>
          <li>Bring your college ID card.</li>
          <li>All code must be written during the event.</li>
          <li>Be respectful to everyone.</li>
        </ol>
        <form method="dialog">
          <button type="submit">Close</button>
        </form>
      </dialog>
    </section>

    <section id="faq" aria-labelledby="faq-title">
      <h2 id="faq-title">Frequently Asked Questions</h2>
      <details name="faq">
        <summary>Is there a registration fee?</summary>
        <p>No. CodeFest is completely free for college students.</p>
      </details>
      <details name="faq">
        <summary>Can first-year students take part?</summary>
        <p>Yes! The DSA contest has a separate beginner category.</p>
      </details>
      <details name="faq">
        <summary>Will food be provided during the hackathon?</summary>
        <p>Yes, meals and snacks are provided for all hackathon participants.</p>
      </details>
    </section>
  </main>

  <footer>
    <address>
      Contact: <a href="mailto:codefest@example.com">codefest@example.com</a>
    </address>
    <p><small>© 2026 CodeFest Organising Committee</small></p>
  </footer>

  <script>
    const rulesDialog = document.getElementById("rules-dialog");
    document.getElementById("rules-btn").addEventListener("click", () => {
      rulesDialog.showModal();
    });
  </script>
</body>
</html>

Open index.html in your browser by double-clicking it.

Output (what the browser shows, top to bottom, with the browser's default styles):

Skip to main content                          (blue underlined link)
(navy circle logo with white < > brackets)
  • About
  • Events                                    (bulleted list of links)
  • Register
  • FAQ

CodeFest 2026                                 (largest heading)
4–5 December 2026 · Main Auditorium, Government Engineering College

About the Festival
    [ your photo, 600 × 300 ]                 (indented: figures have a margin)
    Last year's hackathon had 40 teams from 12 colleges.
CodeFest is a free, student-run festival for anyone who loves to build things. ...

Events
                CodeFest 2026 schedule        (caption, centred)
           Event               Day       Time                    Team size
     24-hour Hackathon        Fri–Sat   10:00 AM to 10:00 AM    2–4
        DSA Contest           Saturday  11:00 AM to 2:00 PM     1
 Talk: Cracking Placements    Saturday  4:00 PM                 Open to all
 (header cells, including the event names, are bold and centred)

Register
Registration closes on 25 November 2026. Fields marked (required) must be filled in.
Full name (required)
[____________]
College email (required)
[____________]
Year of study
[1st year ▾]
┌ Events you want to join ───────────────────┐
│ ☐ Hackathon                                │
│ ☐ DSA Contest                              │
│ ☐ Placement talk                           │
└────────────────────────────────────────────┘
☐ I have read the rules (required) [Read the rules]
[Register for free]

Frequently Asked Questions
▶ Is there a registration fee?
▶ Can first-year students take part?
▶ Will food be provided during the hackathon?
Contact: codefest@example.com                 (italic: the default style of <address>)
© 2026 CodeFest Organising Committee          (small text)

It's plain, but everything works: the links jump to their sections, the form checks required fields, the rules open in a modal dialog, and the FAQ opens one answer at a time.


Step 4: Understanding Each Part

The Head: Identity, SEO and Sharing

Code

Why it's there

Chapter

<!DOCTYPE html>, lang="en", charset

Standards mode, correct language and characters (the "–" and "©" display correctly)

HTML Document Structure

viewport meta

Proper layout on phones

The Head Element & Meta Tags

Specific <title> and description

Search result headline and snippet

HTML for SEO

rel="canonical"

One preferred URL for the page

HTML for SEO

og: tags

A nice preview when the link is shared on WhatsApp or LinkedIn

HTML for SEO

(Replace codefest.example.com with your real domain when you publish. example.com is a domain reserved for documentation examples.)

  • The skip link is the first thing a keyboard user reaches. Pressing Enter on it jumps to id="main", past the navigation (Accessibility Basics).

  • The logo is inline SVG, reusing the bracket path from the Canvas & SVG chapter. role="img" and aria-label give it a name, and it stays sharp at any size.

  • The navigation is a list of links inside <nav>. Each href="#events" is a fragment link to an element with that id (Links chapter). aria-label="Main" names the landmark, which helps if a page has more than one <nav>.

The Main Content and Sections

There is exactly one <h1>, and each <section> starts with an <h2>. The aria-labelledby attribute links each section to its heading, so screen readers announce it as a named region, for example "Events, region". The heading outline is:

h1  CodeFest 2026
 ├── h2  About the Festival
 ├── h2  Events
 ├── h2  Register
 │    └── h3  Rules          (inside the dialog)
 └── h2  Frequently Asked Questions

The Figure

The photo sits in a <figure> with a <figcaption>. The alt describes what's in the photo, while the caption adds information that sighted users also read. The width and height attributes let the browser reserve space before the image loads, so the page doesn't jump (good for CLS).

The Schedule Table

This is genuinely tabular data (rows of events, columns of properties), so a table is the right choice (Tables chapter). Notice:

  • <caption> names the table.

  • Column headers use <th scope="col">, and each event name is a row header, <th scope="row">. A screen reader can then announce a cell as "DSA Contest, Time, 11:00 AM to 2:00 PM".

  • <time datetime="2026-12-05T11:00"> gives a machine-readable date and time alongside the human-friendly text.

The Registration Form

  • Every input has a <label>, either with for/id or by wrapping the input (Forms chapter).

  • type="email" and required give free browser checks: submitting with an empty name or an invalid email shows a message and stops the submission (Built-in Form Validation).

  • autocomplete="name" and "email" let the browser fill in saved details.

  • The checkboxes are grouped in a <fieldset> with a <legend>, so the question "Events you want to join" is announced with each option.

  • "(required)" is written as text, not shown only with colour or an asterisk.

  • Both buttons have an explicit type. "Read the rules" is type="button", so clicking it opens the dialog without submitting the form.

The form's action="/register" needs a server program to receive the data; that's back-end work outside HTML. On your computer, submitting will show an error page, which is expected.

The Rules Dialog

The rules live in a <dialog> (Modern Elements: dialog, details & summary). A few lines of JavaScript at the end of the body call showModal() when "Read the rules" is clicked. Inside, <form method="dialog"> makes the Close button close the dialog without any script, and Esc works too.

The dialog is placed outside the registration form on purpose: forms can't be nested, and the dialog has its own method="dialog" form.

The FAQ Accordion

Three <details> elements share name="faq", so opening one question closes the others, with no JavaScript at all.

<address> marks up contact information for the page's owners (not postal addresses in general), and <small> is meant for side comments like copyright notices (Text Formatting).


Step 5: Validate and Test

Never call a page finished until you've checked it. We ran both validators from the HTML Best Practices & Validation chapter on this file:

W3C Nu Html Checker:       no errors or warnings
npx html-validate index.html:   (no output = no problems)

A note from building this project: the first draft of this project had all three checkboxes named name="events". That is valid HTML (the server receives several values), and the W3C checker accepted it, but html-validate reported Duplicate form control name "events" because of a stricter style rule. We changed to separate names (hackathon, dsa, talk), which is simpler to process anyway. Different tools have different extra rules, so read each message and decide.

Then do the manual tests:

Test

What to check

Keyboard only

Tab reaches the skip link first; every link, field and button is reachable; the dialog opens with Enter, closes with Esc, and focus returns to "Read the rules"

Form validation

Submitting empty shows "Please fill out this field" (wording varies by browser) on the name field

Images off / missing

Rename the photo temporarily; the alt text appears in its place

Phone width

In DevTools device mode (Ctrl + Shift + M in Chrome), the page has no sideways scrolling, except possibly the table

Lighthouse

Run it in Chrome DevTools and read the Accessibility and SEO suggestions

Screen reader (optional)

With NVDA or VoiceOver, list the headings and landmarks; they should match the outline above


Step 6: Final Checklist

Use this list for every page you build from now on:

  • ☐ Doctype, lang, charset, viewport, unique <title> and meta description

  • ☐ Landmarks: <header>, <nav>, <main>, <footer>

  • ☐ One <h1>; headings in logical order

  • ☐ Every image has suitable alt, plus width and height

  • ☐ Every form control has a label; related controls in a <fieldset>

  • ☐ Links are <a href> with descriptive text; actions are <button>s with a type

  • ☐ Tables used only for data, with <caption> and <th scope>

  • ☐ No obsolete elements, no inline styles, unique ids

  • ☐ Zero validator errors

  • ☐ Fully usable with the keyboard alone


Take It Further

Try these extensions on your own; each one practises a chapter:

  1. Add a "Speakers" section with a <figure> for each speaker, using srcset to serve a smaller photo on phones (Responsive Images: srcset & picture).

  2. Add a short promo video with controls, a poster image and a captions <track> (Audio & Video).

  3. Embed a map of the venue with an <iframe> that has a title and loading="lazy" (Iframes & Embedding Content).

  4. Add a canvas bar chart showing registrations per college, with a text alternative (Canvas & SVG).

  5. Add JSON-LD structured data describing the event (search for the Schema.org Event type) and test it with Google's Rich Results Test (HTML for SEO).

  6. Make a second page, rules.html, link the two pages together, and keep the same header and footer on both.


Interview Questions

How would you structure the HTML of a simple landing page?

Start with the document skeleton (doctype, lang, meta charset and viewport, title, description). Then use landmarks: a <header> with the logo and a <nav>, a single <main> containing one <h1> and a <section> with an <h2> for each topic, and a <footer> with contact information. Choose elements by meaning (tables for data, forms with labels, buttons for actions), then validate and test with the keyboard.

Why did we use type="button" on the "Read the rules" button?

Inside a form, a <button> without a type is a submit button by default. Clicking it would submit the registration form instead of only opening the dialog.

Why is the dialog placed outside the registration form?

Forms can't be nested inside other forms. The dialog contains its own <form method="dialog"> for the Close button, so it has to sit outside the registration form.

When is a table the right choice in this page, and when wouldn't it be?

The event schedule is tabular data (each row is an event, each column a property), so a table is correct. Using a table just to place the logo next to the navigation, or to make columns of text, would be layout, which belongs to CSS.

Conclusion

  • Plan first: list the content, sketch a wireframe and map each box to a semantic element.

  • A complete page combines the head (identity, SEO, sharing), landmarks, a clear heading outline, accessible media, data tables, labelled forms, and modern interactive elements like <dialog> and <details>.

  • Always validate and test with the keyboard before calling a page done.

  • Good HTML is the foundation that CSS, JavaScript, accessibility and SEO all build on.

Congratulations on finishing the HTML tutorial! Your CodeFest page is correct and well-structured but looks plain. The natural next step is the CSS tutorial, where you'll turn this exact page into a beautiful, responsive design without changing its HTML much at all.