Coding Lesson

← All lessons

Your final website

Build and test your website

Lesson 17 of 18 · About 35 minutes

Your goal: Combine structure, style and interaction.

Learn

Building is only half the job: testing tells you whether the page delivers what you planned. You will combine your existing HTML, CSS and JavaScript, then check content, layout and interaction in separate passes. Make one small change at a time so mistakes are easier to locate.

Walkthrough: why the code works

  1. Start with a known working copy

    Open your saved hobby page and keep a backup. Compare it with the plan from lesson 16. Finish the two sections and useful link before adding extra decoration. If you use the minimal starter, it is your job to add the project content rather than submit the generic heading and sentence.

  2. Keep the three languages in their places

    Use HTML in body for content, CSS in style inside head, and JavaScript in script after the elements it uses. Bring in the button interaction from lesson 12 or 15. If another element already has the same id, rename it and update every reference. Run the code after each addition.

  3. Test the reader’s main task

    Read the page as someone new to the hobby. Can they find both sections and understand the advice? Follow each real link and check the destination. Look at the image and compare it with its alternative description. Remove sample wording that does not help this reader.

  4. Test narrow layout and keyboard operation

    Check a phone-sized window and 200% zoom. Text and images should fit without clipping. Use Tab to move through links and buttons. Activate links with Enter and native buttons with Enter or Space. The focus indicator should remain visible. Keep browser outlines, or replace them with a clear visible style.

    button:focus-visible, a:focus-visible {
      outline: 3px solid #1d4ed8;
      outline-offset: 3px;
    }
  5. Exercise every state and save the evidence

    Test your interaction more than once. A toggle should show, hide and show again with the correct label. A resettable counter should show 3 after three clicks, then 0 after Reset and 1 after another Add. Download the HTML and repeat the checks in that saved file. Keep brief notes of what you tested and what you fixed.

Expected results

  • The finished page meets the written plan with your own content, two sections and a useful link.

  • The layout remains readable when narrow or zoomed, and controls work with a keyboard.

  • The downloaded copy produces the same result as the latest preview, including repeated interaction tests.

Common mistakes and how to fix them

  • Several changes broke the page at once: Return to the last working copy or undo the latest change. Add back one part at a time and test each one.

  • A JavaScript error prevents the button working: Inspect the console and start with the first relevant error. Check matching ids, straight quotes, parentheses and braces.

  • Hiding overflow made the page seem fixed: Check that no content or control was clipped. Repair the width or image causing the overflow instead.

  • The submitted file is an older version: Download after the final edits, then reopen that exact file and repeat the core checks.

View starter code
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>My hobby page</title>
    <style></style>
  </head>

  <body>
    <h1>My hobby</h1>
    <p>I enjoy learning something new.</p>
  </body>
</html>

Your challenge

Finish your own page. Check headings, links, alternative text, phone layout and keyboard operation. Download a tested copy.

Keep developing your hobby page: Download HTML before leaving the sandbox, then choose Open HTML file when returning to your project. Load saved draft restores only this lesson’s draft in this browser.

Practise in the sandbox
Show a hint

Use Tab to reach each link and button. Press Enter or Space on buttons. Test the interaction more than once.

Show a sample answer

Try the challenge first. This is one possible answer or a snippet to adapt.

Checklist: one main heading; logical section headings; descriptive links; useful alt text; readable colours; no sideways scrolling; visible keyboard focus; working interaction; downloaded backup.

Check your work

The page has two sections, useful content, readable styling, working links and a working keyboard-accessible interaction.

Completion is your own check, not an automatic grade.