The best HTML <input> tag Tutorial In 2024, In this tutorial you can learn Examples,Browser Support,Tag definitions and instructions,Tips and Notes,Differences between HTML 4.01 and HTML5,Differences between HTML and XHTML,Attributes,Global Properties,Event Properties,
A simple HTML form that contains two text input boxes and a submit button:
Most browsers support <input> tag.
<Input> tag specifies the user can enter a field in which the input data.
<Input> elements in the <form> element is used for declaring allows users to enter data input controls.
Input fields can be changed in many ways, depending on the type attribute.
Note: <input> element is empty, it contains only tag attributes.
Tip: You can use the <label> to define the label <input> element element.
In HTML 4.01, "align" the data is no longer used. This attribute is not supported in HTML5. You can define the alignment of the <input> elements using CSS.
In HTML5, <input> add several properties, and adds the corresponding value.
In HTML, <input> tag has no end tag.
In XHTML, <input> tag must be closed properly.
New: HTML5 new tags.
Attributes | value | description |
---|---|---|
accept | audio / * video / * image / * MIME_type | Type specifies by file upload to submit documents. (Only for type = "file") |
align | left right top middle bottom | HTML5 obsolete, deprecated. Predetermined alignment of the input image. (Only for type = "image") |
alt | text | Define the image alternate text input. (Only for type = "image") |
AutoComplete New | on off | autocomplete attribute specifies the <input> element input field whether you should enable auto-completion. |
The autofocus New | autofocus | Attribute specifies when the page loads <input> element should automatically get focus. |
checked | checked | Attribute specifies checked when the page loads should be pre-selected <input> elements. (Only for type = "checkbox" or type = "radio") |
disabled | disabled | disabled property provisions should be disabled <input> elements. |
form New | form_id | form attribute specifies <input> elements in the form of one or more belongs. |
formaction New | URL | URL attribute specifies the input control process when the form submissions. (Only for type = "submit" and type = "image") |
formenctype New | application / x-www-form-urlencoded multipart / form-data text / plain | Attribute specifies when the form is submitted to the server how to encode the data (only for type = "submit" and type = "image"). |
formmethod New | get post | Define Send form data to the action URL of the HTTP method. (Only for type = "submit" and type = "image") |
formnovalidate New | formnovalidate | formnovalidate property overrides <form> novalidate attribute of the element. |
formtarget New | _blank _self _parent _top framename | After submitting the form prescribed showing where displays the received response name or keyword. (Only for type = "submit" and type = "image") |
height New | pixels | Provisions <input> element's height. (Only for type = "image") |
List New | datalist_id | Property reference <datalist> element, which contains predefined options <input> elements. |
MAX New | number date | Attribute specifies the <input> maximum element. |
maxlength | number | Attribute specifies the <input> elements maximum number of characters allowed. |
min New | number date | Attribute specifies the <input> element of the minimum. |
Multiple New | multiple | Attribute specifies allows users to enter multiple values <input> elements. |
name | text | name attribute specifies the <input> element's name. |
pattern New | regexp | attribute specifies the pattern used to validate <input> element of the value of regular expressions. |
placeholder New | text | The placeholder attribute provides for a brief description of the message input <input> field is the expected value. |
readonly | readonly | readonly attribute specifies the input field is read-only. |
required New | required | Attribute specifies the input fields must be filled in before submitting the form. |
size | number | Visible width attribute specifies the size in terms of number of characters <input> elements. |
src | URL | Src attribute specifies the URL submit button displayed as an image. (Only for type = "image") |
STEP New | number | step attribute specifies the legal digital <input> element interval. |
type | button checkbox color date datetime datetime-local file hidden image month number password radio range reset search submit tel text time url week | <Input> type attribute specifies the type of element you want to display. |
value | text | Specifies the <input> element value of value. |
width New | pixels | Attribute specifies the width <input> element width. (Only for type = "image") |
<input> tag supports the global attributes, view complete the property sheet HTML Global Attributes .
<input> tag supports all HTML event attributes .