Example
An HTML form with three input fields; two text fields and one submit button:
<form action="demo_form.asp">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="submit" value="Submit">
</form>
Definition and Usage
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.
Tips and Notes
Note: The <input> element is empty, it contains attributes only.
Tip: Use the
<label> element to define labels for <input> elements.
Differences Between HTML 4.01 and HTML5
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.
Differences Between HTML and XHTML
In HTML, the <input> tag has no end tag.
In XHTML, the <input> tag must be properly closed, like this <input />.
Post a Comment