HTML <form> Tag


The <form> HTML element sets the form on the web page. The form is intended for data exchange between the user and the server. The scope of the forms is not limited to sending data to the server, using client scripts you can access any element of the form, change it and apply it as you wish.
A document can contain any number of forms, but only one form can be sent to the server at a time. For this reason, these forms must be independent of each other.


Permitted Parents
Any element that accepts flow content
Block, inline, and text, but not containing <form> elements
Start/End Tags
Start tag: required, End tag: required


<form action="" method="post">
First name: <input type="text" name="first_name" /><br />
Last name: <input type="text" name="last_name" /><br />
<input type="submit" value="Submit" />


Attribute Definition
accept-charset Specifies a list of character encodings that the server accepts.
action Specifies a URI/URL of the page that will process the form.
autocomplete Specifies whether a form should have autocomplete on or off
enctype Specifies the content type used to encode the form data set when it's submitted to the server.
Possible values:
  • application/x-www-form-urlencoded (default)
  • multipart/form-data (use this when uploading files)
method Specifies the HTTP method to use when the form is submitted.
Possible values:
  • get (the form data is appended to the URL when submitted)
  • post (the form data is not appended to the URL)
name Assigns a name to the form. This is used when referencing the form with stylesheets or scripts. If there are multiple forms, the name of each form must be unique.
novalidate Specifies that the form should not be validated when submitted

Specifies where to open the action URL.
Possible Values:

  • _blank
  • _parent
  • _self
  • _top

Global Attributes

The <form> tag also supports the Global Attributes in HTML5

Event Attributes

The <form> tag also supports the Event Attributes in HTML5

Browser Support

The following table will show you the current browser support for the HTML <form> tag.

Edge Chrome Firefox Opera Safari
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview

Last updated by CSSPortal on: 30th March 2024