![]() |
VOOZH | about |
HTML forms, defined using the <form> tag, are essential for collecting user input on web pages. They include interactive controls like text fields, emails, passwords, checkboxes, radios, and buttons.
Output:
π HTML FormsSyntax:
<form>
<!--form elements-->
</form>This HTML form collects users personal information, including name, email, password, gender, date of birth, and address. It features proper styling for input fields and submission buttons.
Output:
π HTMLForm3Here are some of the key attributes that can be used with the <form> element:
Below are essential HTML form elements used to build interactive and user-friendly forms:
Elements | Descriptions |
|---|---|
| <label> | It defines labels for <form> elements. |
| <input> | It is used to get input data from various types such as text, password, email, etc by changing its type. |
| <button> | It defines a clickable button to control other elements or execute a functionality. |
| <select> | It is used to create a drop-down list. |
| <textarea> | It is used to get input long text content. |
| <fieldset> | It is used to draw a box around other form elements and group the related data. |
| <legend> | It defines a caption for fieldset elements |
| <datalist> | It is used to specify pre-defined list options for input controls. |
| <output> | It displays the output of performed calculations. |
| <option> | It is used to define options in a drop-down list. |
| <optgroup> | It is used to define group-related options in a drop-down list. |
Here are the commonly used input types in HTML Forms:
Input Type | Description |
|---|---|
Defines a one-line text input field | |
Defines a password field | |
Defines a submit button | |
Defines a reset button | |
Defines a radio button | |
Validates that the input is a valid email address. | |
Allows the user to enter a number. You can specify min, max, and step attributes for range. | |
Used for checkboxes where the user can select multiple options. | |
Allows the user to select a date from a calendar. | |
Allows the user to select a time. | |
Allows the user to select a file to upload. |