JomMula

Frontend Development: HTML to React · HTML · Lesson 05

HTML checkpoint: build the calculator page

Time to put the whole page together: header, form, results, food log table, and footer. It will look plain — that's exactly where we want to be before CSS.

8 min readHTMLbuildUpdated October 2026

This is the checkpoint for part 1. No new big concepts — we’re putting the pieces together into one complete page.

It will look like a website from 1998. That’s fine. Structure first.

The plan

Our calculator page has five pieces:

  1. Header — the title and navigation.
  2. Calculator section — the form from lesson 4.
  3. Results section — a big number that will show the calorie target.
  4. Food log section — an “add food” form and a table of what you ate.
  5. Footer — a small note.

The table is new. Let’s cover it quickly.

Tables, the right way

Tables are for data that belongs in rows and columns — not for layout. A food log is a perfect fit.

<table>
  <caption>Today's food</caption>
  <thead>
    <tr>
      <th scope="col">Food</th>
      <th scope="col">Calories</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Oatmeal</td>
      <td>150</td>
    </tr>
  </tbody>
  <tfoot>
    <tr>
      <th scope="row">Total</th>
      <td>520</td>
    </tr>
  </tfoot>
</table>
  • <caption> describes the table. It’s not just a title; screen readers use it.
  • <thead>, <tbody>, and <tfoot> group the header, body, and footer rows.
  • <th> is a header cell. scope="col" says it labels a column; scope="row" says it labels a row.
  • <td> is a normal data cell.

The complete page

Here it is — everything from part 1 in one file. Read it top to bottom and match each section to the plan above.

Preview

Edit the code, then hit Run (or Ctrl + Enter) and watch the preview. This is a safe sandbox — you can't break the page.

Yes, it’s ugly

That’s the point. You’ve built a page with:

  • A clear document structure.
  • Semantic landmarks.
  • A complete, accessible form.
  • A real data table with a caption and scoped headers.
  • A results area that’s ready for JavaScript.

Everything that’s missing is visual. We’ll fix that in part 2 with CSS.

Finish the page

the plan's verify step

Build the full page in your index.html. Add two more food rows to the table and update the total. Then check your headings: one h1, h2 for each section, no skipped levels.

Optional: paste your file into validator.w3.org to catch unclosed tags. Don't obsess over warnings; fix errors first.

What to check before moving on

  • One <h1>, and <h2> for each section.
  • Header, nav, main, two or three sections, footer.
  • Every input has a label with a matching for/id.
  • Radio buttons share a name.
  • The table has a caption, thead, tbody, tfoot, and scoped headers.
  • The result paragraph has an id (we’ll grab it with JavaScript later).

A complete page is a set of semantic sections, not a pile of divs.

Tables are for data: caption, thead, tbody, tfoot, th with scope.

Every form control has a label, a name, and the right type.

The unstyled page is the skeleton; CSS comes next.

Tab through the page — if it works with a keyboard, it works.

That’s part 1 done. You can write a complete, accessible HTML page from scratch. Next up: CSS — making it look like something you’d actually want to use.

Previous: Forms and inputs: the calculator's controls
06

Up next

CSS basics: selectors, cascade, and the box model

CSS is a list of rules: pick an element, say what it should look like. Learn selectors, the cascade, and the box model — the three ideas behind every layout you'll ever build.

Read now