Javatpoint Logo

91-9990449935

 0120-4256464

HTML Input Tag

The HTML <input> tag is used to represent a form input control in HTML document. This form input control facilitate user to input data and communicate with a website or application. Let's take an example of an HTML form with three input fields, two text fields and one button for submission.


HTML Input Tag Example

Let's see the example of HTML input tag.

Test it Now

Output:

First name:
Last name:

Click the "Submit" button for sending the form-data to a page on the server.


Points to remember

1) Use the input element within the form element to declare input control that allow user to enter data.

2) The input element is empty. It contains attributes only. There is no need of an end tag in HTML.

3) If you want to define labels for input element, use the label element with each input tag.


Difference between HTML4.01 and HTML5

HTML5 does not support "align" attribute. There are several new attributes for <input> tag in HTML5, and the type attribute has several new values.


Difference between HTML and XHTML

In HTML, <input> tag is used without an end tag. In XHTML, the <input> tag must be properly closed.


Supporting Browsers

Elementchrome browser Chromeie browser IEfirefox browser Firefoxopera browser Operasafari browser Safari
<input>YesYesYesYesYes
Next TopicHTML Button Tag