HTML input Tag defines an input field inside the form element which can take data input from the users. There are 22 types of input elements, all of them are used to take input from the user.
Table of Contents
Syntax of HTML input Tag
The Syntax of HTML input Tag is shown below, It has only starting tag.
<input type="text" id="name" name="uname">
Usage of HTML input Tag
HTML input Tag is used to take the input from the user.
This input from the user can be used to perform a specific task, for example calculation etc.
There are 22 types of input elements. The type of input element is defined using the type attribute.
All types of input element are listed below.
- <input type="text">
- <input type="password">
- <input type="submit">
- <input type="button">
- <input type="email">
- <input type="file">
- <input type="number">
- <input type="search">
- <input type="radio">
- <input type="checkbox">
- <input type="date">
- <input type="hidden">
- <input type="tel">
- <input type="reset">
- <input type="image">
- <input type="month">
- <input type="color">
- <input type="datetime-local">
- <input type="time">
- <input type="range">
- <input type="url">
- <input type="week">
HTML input Tag is an inline element.
Example of HTML input Tag
Simple example of HTML input Tag is shown below.
<input type="text" id="name" name="uname">
In above example a text type of input element is used which will take the textual input from the user.
<input type="password" id="pass" name="pass">
In above example a password type of input element is defined which is used to take the password from the user.
The id attribute is used to define a unique id for the input element.
The name attribute specify the name of the input element which is also used to access the value of input element.
Browser Support for HTML input Tag
HTML input Tag is supported by all major browsers including Safari and Internet Explorer.
Global Attributes Support in HTML input Tag
The HTML input Tag supports all Global Attributes.
Event Attributes Support in HTML input Tag
The HTML input Tag supports all Event Attributes.
HTML input Tag Video
Watch our video on HTML input Tag.