HTML CSS examples for HTML Tag:form
The form element marks a form in an HTML page.
The table Element summary
Item | Value |
---|---|
Element: | form |
Permitted Parents: | the form element cannot be a descendant of another form. |
Local Attributes: | action, method, enctype, name, accept-charset, novalidate, target, autocomplete |
Contents: | Flow content (but particularly label and input elements) |
Tag Style: | Start and end tags |
New in HTML5? | No |
Changes in HTML5 | The novalidate and autocomplete attributes are new in HTML5. |
Style Convention
form { display: block; margin-top: 0em; }
To create a basic form, you need three elements: the form, input, and button elements.
The following code shows an HTML document that contains a simple form.
<!DOCTYPE html> <html> <head> <title>Example</title> </head> <body> <form method="post" action="http://example.com/form"> <input name="fave"> <button>Submit Vote</button> </form> </body><!--from w ww .j a va 2 s. c o m--> </html>