CHAPTER 30 · HTML

Guided project: build and check a college practice timetable

Turn the table lessons into a small page a classmate can use. Begin with the data, build a working draft, add preparation details and readable styling, then test the result against a clear checklist.

Download example files (ZIP)

The problem you are solving

A fictional college practice group needs a page showing its sessions. Students want to know what they will practise, where to go, how long it lasts and what to bring. A message containing all the facts in one long sentence is difficult to compare.

The goal is a static HTML timetable. Static means the saved page supplies the current values. It does not accept bookings, detect attendance or calculate totals automatically. We can still make it useful through clear data, accessible relationships and careful checks.

Agree on the requirements first

A requirement is something the finished page must do or contain. Write these down before adding decorative details.

  1. Show a meaningful browser title and page heading.
  2. Give the timetable a clear caption.
  3. List session, room, duration in minutes and preparation in separate columns.
  4. Give every column a real header and every session a row header.
  5. Group labels, records and the duration summary appropriately.
  6. Include three fictional sessions, with durations of 30, 45 and 30 minutes.
  7. Make all columns reachable on a narrow screen without tiny text.
  8. Explain that the total is written manually and must be updated after edits.

Use only the information the task needs. A working timetable does not need personal phone numbers, real student records or a payment button.

Plan the data before writing tags

SessionRoomMinutesPreparation
Headings practiceRoom 630One saved notice
Link practiceRoom 845Two linked HTML files
Table reviewRoom 630A checked timetable

The total duration is 30 + 45 + 30 = 105 minutes. This is the sum of session durations, not a promise about the event's full elapsed time; breaks or overlapping sessions would need separate explanation.

Do not mix 30 minutes and 1 hour as bare numbers in one totals column. Here every duration uses the same unit, and the column header states that unit.

Build from a checkable plan
  1. 1Write requirements and consistent units
  2. 2Create a small valid draft
  3. 3Add records and recheck summaries
  4. 4Test data, narrow view and keyboard use

The final timetable has three sessions and 105 minutes. Static totals must be edited when records change.

Step 1: build a small working draft

Start with two records and the three columns needed to check basic relationships. This is a valid draft, but it does not yet meet every final requirement. Save it as timetable-start.html so you can compare it with the completed version later.

Complete program: timetable-start.html

timetable-start.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Practice Timetable Draft</title>
</head>
<body>
  <h1>Draft the college practice plan</h1>
  <p>This draft contains two fictional sessions. Preparation details come next.</p>
  <table>
    <caption>First draft of the practice timetable</caption>
    <thead>
      <tr><th scope="col">Session</th><th scope="col">Room</th><th scope="col">Minutes</th></tr>
    </thead>
    <tbody>
      <tr><th scope="row">Headings practice</th><td>Room 6</td><td>30</td></tr>
      <tr><th scope="row">Link practice</th><td>Room 8</td><td>45</td></tr>
    </tbody>
    <tfoot>
      <tr><th scope="row" colspan="2">Total session minutes</th><td>75</td></tr>
    </tfoot>
  </table>
</body>
</html>
Browser previewDocument title: Practice Timetable Draft

This preview shows the example in a browser. Save the complete code in local files to test links between pages and downloads. Same-page section links work here.

Expected result: two sessions and a total of 75. The footer's label spans the Session and Room positions, leaving its number under Minutes. Without styling, there may be no visible grid lines. Check structure and values before adding CSS.

Step 2: make a controlled change

Add the third session with duration 30, then update the total to 105. Add a Preparation header and a corresponding preparation cell to every body row. The footer needs a fourth position too, so we will add a short note there.

After each change, save, refresh and compare with the requirements. Do not change five unrelated things and then guess which one broke the grid. A controlled change is a small edit with an expected result you can check.

Step 3: explain the small amount of styling

The completed version reuses Chapter 28's borders, padding and colours. Body font-family: sans-serif requests a plain sans-serif font, line-height: 1.5 gives text more breathing room, and color sets the foreground text colour.

Width: 100% lets the table use its available container width; min-width: 620px keeps the four-column example readable. If the container is narrower, its overflow-x: auto provides horizontal scrolling. The wrapper is focusable and named as in Chapter 29.

The selector tbody tr:nth-child(even) adds a pale background to alternate body rows. This is a reading aid, not the only indication of any status. Caption-side: top places the caption above the table. These styles support the content without replacing its headers.

Complete program: college-timetable.html

college-timetable.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>College Practice Timetable</title>
  <style>
    body { font-family: sans-serif; line-height: 1.5; color: #24382b; }
    .table-window { overflow-x: auto; max-width: 100%; }
    .table-window:focus-visible { outline: 3px solid #31573d; outline-offset: 3px; }
    table { border-collapse: collapse; width: 100%; min-width: 620px; }
    caption { caption-side: top; text-align: left; font-weight: bold; padding: 8px; }
    th, td { border: 1px solid #687466; padding: 10px; text-align: left; }
    thead, tfoot { background-color: #e8efdf; }
    tbody tr:nth-child(even) { background-color: #f6f5ee; }
  </style>
</head>
<body>
  <h1>Prepare for the college practice sessions</h1>
  <p>These fictional sessions help students revise one idea at a time.</p>
  <p id="schedule-help">Durations are in minutes. On a narrow screen, scroll the table sideways; keyboard users can focus its container and use arrow keys.</p>
  <div class="table-window" tabindex="0" role="region" aria-labelledby="schedule-caption" aria-describedby="schedule-help">
    <table>
      <caption id="schedule-caption">College practice timetable and preparation</caption>
      <thead>
        <tr><th scope="col">Session</th><th scope="col">Room</th><th scope="col">Minutes</th><th scope="col">Preparation</th></tr>
      </thead>
      <tbody>
        <tr><th scope="row">Headings practice</th><td>Room 6</td><td>30</td><td>One saved notice</td></tr>
        <tr><th scope="row">Link practice</th><td>Room 8</td><td>45</td><td>Two linked HTML files</td></tr>
        <tr><th scope="row">Table review</th><td>Room 6</td><td>30</td><td>A checked timetable</td></tr>
      </tbody>
      <tfoot>
        <tr><th scope="row" colspan="2">Total session minutes</th><td>105</td><td>Three sessions</td></tr>
      </tfoot>
    </table>
  </div>
  <h2>Before you share the plan</h2>
  <p>The total is written manually. Recheck it whenever a session duration changes.</p>
  <p><a href="link-home.html">Revisit the two-page link exercise</a></p>
</body>
</html>
Browser previewDocument title: College Practice Timetable

This preview shows the example in a browser. Save the complete code in local files to test links between pages and downloads. Same-page section links work here.

Expected result: a captioned four-column timetable with three sessions and a footer total of 105. At narrow widths, the last column remains available through scrolling. The link exercise opens another real file in the supplied example ZIP.

Step 4: test with expected answers

CheckExpected result
Session countThree body rows
Link practice roomRoom 8
Table review preparationA checked timetable
Total minutes105
Footer alignmentTotal number below Minutes
Narrow viewPreparation remains reachable
KeyboardVisible focus and a usable horizontal scroll route
Local linklink-home.html opens from the extracted folder

Reading the page without comparing it to intended results is not enough. Ask a partner to find a room and preparation item without your help. Their difficulty may reveal a wording problem even when the HTML parses correctly.

Step 5: inspect the source and keep it maintainable

Check that ids are unique, the caption names the table and each body row has a th session name. Count the effective column positions in the footer, including its colspan. Confirm that the table groups are in a sensible order.

If a session becomes cancelled, do not communicate that only with a red background. Use clear visible wording and update the durations and summary according to an explained rule. If you add a new data column, update its header, every relevant body row and the footer grid.

Problem and solution: the finished page no longer matches the plan

Problem: a student adds Table review but leaves the total at 75 and the footer note at Two sessions.

Solution: use the checklist to find both stale values. Update the total and count, then recheck the table. HTML does not keep repeated facts synchronised automatically. A small page still needs careful editing.

Common mistakes and useful tips

  • Decorating the table before confirming its records and units.
  • Adding a column to only some rows.
  • Repeating a cell already covered by colspan in the footer.
  • Treating manually written totals as formulas.
  • Removing useful headers to make the page visually smaller.
  • Testing only at one wide browser width.
  • Calling the project complete before checking its requirements.

Practice questions

  1. Which final requirements does the starter page not yet meet?
  2. Why does the final table's footer use colspan="2"?
  3. What is the new total if Table review changes from 30 to 40 minutes?
  4. Why does the preparation column need a value in every body row?
  5. What should a narrow-screen test prove beyond merely showing a scrollbar?
  6. Add a fourth session called Revision clinic in Room 8 for 20 minutes, with preparation One question to discuss. Update the final page and check every requirement again.
Check your practice answers
  1. It has only two sessions, lacks the Preparation column and has no narrow-screen scrolling design. Its draft total is correctly 75 for the records it currently contains.
  2. The total label occupies Session and Room, so its numeric value sits in the third column under Minutes.
  3. 115 minutes. Also check any text that describes durations or counts.
  4. Every row must preserve the column relationship. If preparation is unknown, use clear wording rather than silently shifting later values.
  5. The final column must actually be reachable and readable, including through keyboard use when needed. The rest of the article should remain usable.
  6. From the original completed version, the new total is 125 and there are four sessions. Add a row with the same four positions and change the footer count note. Test the data, scrolling and link again.

Interview questions

How did you decide that this content needed a table?

Each session shares the same types of facts, and readers need to compare those facts by row and column. A table expresses those relationships more clearly than one long paragraph.

What makes this a guided project rather than a copied layout?

It starts with requirements and data, builds an intentionally smaller draft, makes controlled changes and checks the result against expected answers. The learner must explain why each part exists.

What must change when a duration is edited in this static page?

Change the record and every manually written summary that depends on it. Recompute the total and retest the expected results. HTML alone does not recalculate the values.

How would you explain the page's current limits?

It is a readable static timetable. It does not provide bookings, automatic totals or live session updates. Those behaviours would need additional programming and a suitable data source.

Quick revision

  • Agree on requirements and units before writing the table.
  • Build the structure, check the data, then improve readability.
  • Maintain static summaries whenever records change.
  • A finished project meets its stated requirements and remains usable at narrow widths.