Skip to main content

The <form> Element

As defined in the HTML Living Standard, the <form> element represents a document section containing interactive controls for submitting information.

Visual Example:
<form action="/submit-demo" method="post">
    <label for="user-name">Name:</label>
    <input type="text" id="user-name" name="username">
    
    <label for="user-email">Email:</label>
    <input type="email" id="user-email" name="email">
    
    <button type="submit">Submit Information</button>
</form>
View HTML Living Standard: The form element

Key Attributes for Accessibility

The <form> element provides critical context to assistive technologies through its attributes:

WCAG Requirement: Form Landmarks

While the <form> element is not a landmark by default, it is highly recommended to wrap complex forms in a <section> or <main> with an aria-labelledby attribute. This allows screen reader users to jump directly to the form using landmark navigation.

Understand SC 1.3.1: Info and Relationships

Common Pitfalls

A11y Tip: Avoid Nested Forms

HTML specifications strictly forbid nesting one <form> inside another. Doing so creates unpredictable behavior across browsers and confuses assistive technologies, often resulting in the inner form being ignored or the outer form submitting prematurely.