Skip to content
Codewilds

Lesson 12 of 29 · Page Structure & Forms

Boss: Build an Accessible HTML Sign-Up Form

Boss battlehard100 XP1 min read

The Form Gatekeeper blocks the way. Every test you pass deals damage — pass them all to defeat it and claim a loot chest.

The gate to the Guild of Web Crafters is guarded by the Form Gatekeeper, an iron sentinel that only admits travellers who hand in a proper application. It can't see sloppy markup: every field needs a label, and every part of the page needs its proper place. Build the guild's sign-up page, and the gate swings open.

Battle plan

This fight uses everything from Chapter 2:

  • semantic regions — <header>, <main>, <section> and <footer> — instead of anonymous boxes
  • a <label> for every field, connected with for and the field's id
  • the right field for each answer: text, email and number inputs, a <select> menu, a <textarea> and a checkbox
  • required, placeholder and min to help visitors fill the form in correctly

Wrap each label and its field in a <p>, so every field gets its own line:

<p>
  <label for="hero">Hero name</label>
  <input type="text" id="hero" name="hero" required>
</p>

Assignment

Build the page inside <body>:

  1. A <header> with the <h1> Guild of Web Crafters.
  2. A <main> with a <section>. The section starts with the <h2> Sign up, followed by a <form> with these six fields. Every field has a <label> whose for matches the field's id, and a name equal to its id:
Label Field id and name Extra
Hero name text input hero required
Email email input email required, placeholder [email protected]
Age number input age min="12"
Class <select> with the options Mage, Knight, Ranger class
About you <textarea> bio
I accept the guild rules checkbox, with the label after the box rules required
  1. At the end of the form, a submit button with the text Send application.
  2. After <main>, a <footer> with the paragraph Members only. No dragons allowed.

Every passing test dents the Gatekeeper's armour. Make all ten pass and walk right through.

Premium lesson

Unlock the full Learn HTML & CSS course

  • All 29 lessons, bosses and quizzes — lifetime access
  • One payment of $35, no subscription
  • Finish within 30 days and claim $10.50 (30%) back
Play the 7 free lessons

Want more than one course?

The All-Access Pass unlocks all 8 courses and every new one we release, for $120 once.

Keep learning

Need a quick reminder? The HTML & CSS cheat sheet has every topic of Learn HTML & CSS on one page.

Lesson last updated on .

Write code ↓
HTML & CSS+100 XP

Lesson 12 is part of the full course. The first 7 lessons are free.

Premium lesson

Unlock the full Learn HTML & CSS course

  • All 29 lessons, bosses and quizzes — lifetime access
  • One payment of $35, no subscription
  • Finish within 30 days and claim $10.50 (30%) back
Play the 7 free lessons

Want more than one course?

The All-Access Pass unlocks all 8 courses and every new one we release, for $120 once.