This is my Day 5 of HTML Learning Journey. Today, I learned about the FORM in HTML.
WHAT IS FORM?
- Form in HTML is used to collect the data from the user.
- Using the
<form>tag, we can get the different type of data from the user. - HTML Form are one of the most important element in the web development.
- They are widely used in websites for user registration, login , feedback, surveys, contact details and many other purposes.
- Over 85% of websites uses form to get the user data.
Syntax:
<form>
...
...
</form>
Elements in Form:
<input><label><select><button><textarea><fieldset><legend><option><optgroup>
Let's explorer the Elements one by one
<input>:
- The input tag is used to create a input field, where the user can enter their data.
- In the input field user can enter the data based on the type attribute of the
<input>tag. - There many input types are available: text, email, password, tell, number, date-time, date, datetime-local, month ....,
<input id="username" name="U-name" type="text">
<label>:
- The label tag is used to provide a description about the input field.
- It is useful for the user to know about the input field, which is helpful for them to enter the correct data.
<label for="username">Username</label>
Output:
<textarea>:
- textarea is used to get a multi-line input from the user.
- In
<textarea>, we can also adjust the height and width of the input field using the cols and rows attribute.
<label>Address</label>
<textarea name="address"></textarea>
<optgroup>
optgroup is used to group the options in the
<select>/ dropdown list.label attribute is used to provide the title for the grouped options.
<label>Courses</label>
<select name="courses" none>
<optgroup label="Frontend">
<option value="react">React</option>
<option value="Angular">Angular</option>
</optgroup>
<optgroup label="Backend">
<option value="Node.js">Node.js</option>
<option value="Spring Boot">Spring Boot</option>
</optgroup>
</select>
<button>:
button tag is used to create a clickable button on the webpage.
Mainly there are two types Reset button and Submit button.
Types of Button:
1.Submit Button - Used to submit the data.
2.Reset Button - Used to reset the webpage.
<button type="submit">Submit</button>
<button type="reset">Reset</button>
<option>:
option is used to create a options in the dropdown list.
The
<option>tag is used inisde the<select>tag.User can select one or more options from the list.
<select name="Language">
<option value="English">English</option>
<option value="Tamil">Tamil</option>
</select>
<legend>:
legend is used to provide the title to the fieldset.
<legend>is used inside the<fieldset>.
<fieldset>
<legend>List of Courses</legend>
<label>Courses</label>
<select name="courses" none>
<optgroup label="Frontend">
<option value="react">React</option>
<option value="Angular">Angular</option>
</optgroup>
<optgroup label="Backend">
<option value="Node.js">Node.js</option>
<option value="Spring Boot">Spring Boot</option>
</optgroup>
</select>
</fieldset>
See you in the next learning update!




Top comments (0)