HTML CSS Bootstrap Javascript Icons Python
HTML References
HTML - Tag Reference HTML - Tag by Category HTML - Attributes HTML - Global Attributes HTML - Events HTML - Language Codes HTML - Country Codes HTML - URL Encoding HTTP Methods HTTP Status Codes <input> types
All HTML Tags
<!-- --> <!DOCTYPE> <a> <abbr> <acronym> <address> <applet> <area> <article> <aside> <audio> <b> <base> <basefont> <bdi> <bdo> <big> <blockquote> <body> <br> <button> <canvas> <caption> <center> <cite> <code> <col> <colgroup> <data> <datalist> <dd> <del> <details> <dfn> <dialog> <dir> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <font> <footer> <form> <frame> <frameset> <h1> - <h6> <head> <header> <hr> <html> <i> <iframe> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <main> <map> <mark> <meta> <meter> <nav> <noframes> <noscript> <object> <ol> <optgroup> <option> <output> <p> <param> <picture> <pre> <progress> <q> <rp> <rt> <ruby> <s> <samp> <script> <section> <select> <small> <source> <span> <strike> <strong> <style> <sub> <summary> <sup> <svg> <table> <tbody> <td> <template> <textarea> <tfoot> <th> <thead> <time> <title> <tr> <track> <tt> <u> <ul> <var> <video> <wbr>

HTML <form> tag

The HTML <form> element is used for creating a form for user input.

The <form> element can contain one or more of the following form elements:

Run code

It is possible to use the :valid and :invalid CSS pseudo-classes to style a form element based on whether or not the individual elements within the form are valid.

Browser compatibility

The <form> element is fully supported by all browsers:

<form> yes yes yes yes yes


The following table shows the attributes that are specific to the <form> tag:

Attribute Value Description
accept MIME_type Specifies a comma-separated list of content types that the server accepts
accept-charset character-set Specifies a list of character encodings that the server accepts. The default value is "unknown"
action URL Specifies a URI/URL of the back-end script that will process the form
autocomplete on
Specifies whether form should have autocomplete on or off
enctype text/plain
The mime type used to encode the content of the form
method GET
Specifies which HTTP method to use when submitting the form (it can be GET or POST)
name string Specifies name of the control, which is submitted with the control's value as part of the form data
novalidate - Indicates that the form is not to be validated when submitted
target _blank
Specifies where to display the response that is received after submitting the form

Global Attributes

The <form> tag supports the global attributes described in HTML Global Attributes Reference

Event Attributes

The <form> tag supports the event attributes described in HTML Events Reference

Last updated: Sunday 23 Sep, 2018