<input> Tag in HTML

The <input> tag in HTML is used to create interactive controls in a web form, such as text fields, checkboxes, radio buttons, submit buttons, etc. It allows the user to enter data or interact with a form.

Key Points on <input> Tag:

Syntax of <input> Tag:

Syntax Example

<input type="text" name="username" placeholder="Enter your username">

Example of <input> Tag in HTML:

This example demonstrates how to use the <input> tag to create a text field and a submit button.

Code Example


        <form>
            <input type="text" name="username" placeholder="Enter your username">
            <input type="submit" value="Submit">
        </form>
                

Output

The <input> tag is extremely versatile and used for various types of form controls. The type attribute is essential to determine the behavior of the input, such as text input, password field, checkboxes, radio buttons, and more. It is also used in combination with forms for submitting user data.