/    Sign up×
Reference /Pin to ProfileBookmark

The form tag creates an HTML form for user input..

Syntax

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>

Attributes

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.

Browser Compatibilty

Demos

User-submitted codepen.io examples of <form>

@steime

See the Pen on CodePen.

Want to Contribute?

Submit a codepen.io link that demonstrates <form>:

to submit a demo.
HTML
×

Success!

Help @reference spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...