Semantic HTML forms: labels, validation, accessible input

10 steps · about 3 h 45 min · Beginner

  1. Your first form - Learn web development (tutorial, MDN Web Docs, 30 min)

    Start by building a simple form and seeing how label for/id links each label to its control.

  2. Forms | web.dev (tutorial, web.dev (Learn HTML), 25 min)

    Covers implicit and explicit labels and fieldsets for groups of radios and checkboxes, which makes controls semantic.

  3. WebAIM: Creating Accessible Forms - Accessible Form Controls (guide, WebAIM, 15 min)

    Shows how labels, fieldset and legend work for text inputs, checkboxes and radios, and how to test them by clicking the label.

  4. <input>: The HTML Input element (reference, MDN Web Docs, 30 min)

    Use it to pick the right input type and attributes, such as pattern and required, for each field.

  5. Design basics | web.dev (tutorial, web.dev (Learn Forms), 15 min)

    Teaches label wording and why every control needs a visible label, before you add validation.

  6. Client-side form validation - Learn web development (tutorial, MDN Web Docs, 40 min)

    Covers built-in HTML validation, then the Constraint Validation API for custom messages.

  7. Forms | web.dev (tutorial, web.dev (Learn Accessibility), 20 min)

    Adds autocomplete, field descriptions and error prevention, and ties them to WCAG 2.2 criteria.

  8. Basic form hints - Accessibility (guide, MDN (archived mirror), 15 min)

    Shows how aria-describedby, aria-required and aria-invalid expose hints and errors to screen readers.

  9. Building Accessible Forms on the Web: A Developer's Guide (article, TestDevLab, 15 min)

    Pulls the pieces together, covering placeholders vs labels, grouping and linked error messages.

  10. HTML Standard: Forms (reference, WHATWG, 20 min)

    Read the official spec on client-side validation to learn why the server must still verify input.