HTML Form

The <form> element groups input controls so users can submit data, such as a login or contact form. Its action attribute sets where the data is sent and method sets how (GET or POST).

Web

Inside a form you place inputs, text areas, checkboxes, selects, and a submit button. When the user submits, the browser bundles the field values and sends them to the server.

Pairing each input with a <label> improves usability and accessibility by making the label clickable and readable by screen readers.

Examples

HTML

<form action="/signup" method="post">
  <label>Email: <input type="email" name="email"></label>
  <button type="submit">Sign up</button>
</form>

Output:

Renders an email field with a label and a 'Sign up' button that posts to /signup.

Learn it in a lesson

See also

Back to the Dictionary