Skip to main content

The <form> Element

As defined in the HTML Living Standard, the <form> element represents a hyperlink that can be manipulated such that it could be sent to the server with additional data, or a set of controls that can be used to perform a task.

Visual Example:
<form action="/api/save" method="post"> <label for="email">Email Address:</label> <input type="email" id="email" name="user_email"> <button type="submit">Subscribe</button> </form> View HTML Living Standard: The form element

Technical Requirements

WCAG Requirement: Labels or Instructions

Success Criterion 3.3.2 (Level A): Labels or instructions are provided when content requires user input.

The <form> is the container for input controls. Every control inside must be programmatically associated with a <label>. This ensures that screen reader users hear the label text when they focus on the input field.

Understand SC 3.3.2: Labels or Instructions

Semantic Grouping

For complex forms, using the <form> element is only the first step. You should group related information to provide structural landmarks.

A11y Tip: Preventing Accidental Submission

Ensure your <form> handles the Enter key predictably. By default, pressing Enter in a single-line text field submits the form. For multi-step forms, ensure the primary action is clearly labeled and that the user is warned of any irreversible consequences (satisfying WCAG SC 3.3.4).