The form
tag creates an HTML form for user input..
There are a number of elements that can be enclosed inside a form tag, such as <input>, <textarea>, <select>, <button>, and more.
<form action="/action-page.php" method="get">
<label for="email">Email Address: </label>
<input type="email" id="email" name="email">
<input type="submit" value="Submit">
</form>
accept-charset
Defines the character encodings used for the form submission.
action
The URL to where the form-data is sent upon submission.
autocomplete
Designates whether a form should use autocomplete or not.
enctype
When using method="post"
, this attribute designates how the form-data should be encoded when it is submitted to the server.
method
Determines which HTTP method is used (get
or post
) when sending form data.
name
Provides the name of the form.
novalidate
Designates that the form should not be validated upon submission.
rel
Provides the relationship between the current document and the linked resource. Possible values are external
, help
, license
, next
, nofollow
, noopener
, noreferrer
, opener
, prev
, and search
.
target
Determines where the response will be displayed after the form is submitted. Possible values are _blank
, _self
, _parent
, or _top
.
User-submitted codepen.io examples of <form>
↴
Submit a codepen.io link that demonstrates <form>
: