Français

<form>

Group fields to send data: signup, search, payment

  • HTML
  • accessibility
  • semantics
  • forms

<form> — The form

The <form> element wraps an interactive form. It defines where (action) and how (method) data is sent. It is the semantic container for all input fields.

When to use it

You want to build a signup form, a search bar, a payment form, a contact form, or any data collection mechanism.

What you gain

Accessibility: screen readers announce entering and leaving the form. Users know they are in an input area and can navigate between fields.

Code example

<form action="/signup" method="post">
  <label for="email">Email:</label>
  <input type="email" id="email" name="email" required>
 
  <label for="password">Password:</label>
  <input type="password" id="password" name="password" required minlength="8">
 
  <button type="submit">Sign up</button>
</form>

Further reading