An HTML form with three input fields; two text fields and one submit button:
First name: input type=text name=fnamebr
Last name: input type=text name=lnamebr
input type=submit value=Submit
/formTry it Yourself
The input tag specifies an input field where the user can enter data.
input elements are used within a form element to declare input controls that allow users to input data.
An input field can vary in many ways, depending on the type attribute.
Note:The input element is empty, it contains attributes only.
Tip:Use thelabelelement to define labels for input elements.
The align attribute is not supported in HTML5.
In HTML5, the input tag has several new attributes, and the type attribute has several new values.
In HTML, the input tag has no end tag.
In XHTML, the input tag must be properly closed, like this input /.
Specifies the alignment of an image input (only for type=image)
Specifies an alternate text for images (only for type=image)
Specifies whether an input element should have autocomplete enabled
Specifies that an input element should automatically get focus when the page loads
Specifies that an input element should be pre-selected when the page loads (for type=checkbox or type=radio)
Specifies that the text direction will be submitted
Specifies that an input element should be disabled
Specifies one or more forms the input element belongs to
Specifies the URL of the file that will process the input control when the form is submitted (for type=submit and type=image)
Defines the HTTP method for sending data to the action URL (for type=submit and type=image)
Defines that form elements should not be validated when submitted
Specifies where to display the response that is received after submitting the form (for type=submit and type=image)
Specifies the height of an input element (only for type=image)
Refers to a datalist element that contains pre-defined options for an input element
Specifies a minimum value for an input element
Specifies that a user can enter more than one value in an input element
Specifies the name of an input element
Specifies a regular expression that an input elements value is checked against
Specifies a short hint that describes the expected value of an input element
Specifies that an input field is read-only
Specifies that an input field must be filled out before submitting the form
Specifies the width, in characters, of an input element
Specifies the URL of the image to use as a submit button (only for type=image)
Specifies the legal number intervals for an input field
The input tag also supports theGlobal Attributes in HTML.
The input tag also supports theEvent Attributes in HTML.
Your message has been sent to W3Schools.