HTML form Tag defines a form element which is used to take input from the user. HTML Form Tag contain elements like input, select, option, submit, button, label, textarea, fieldset, optgroup, output etc.
Table of Contents
Syntax of HTML form Tag
The Syntax of HTML form Tag is shown below, It has both starting and ending tags.
<form>
</form>
Usage of HTML form Tag
HTML form Tag is used to take the information from the user of website. HTML form takes data for submission into database or for further processing.
HTML form tag contain different types of elements for different types of data. These elements include input tag, file element, select element, option element, textarea, submit element, button tag, optgroup, fieldset, labels, output element and more.
HTML form element is validated using JavaScript to make sure that correct information is submitted.
HTML form Tag is a block level element.
Example of HTML form Tag
Simple example of HTML form Tag is shown below.
<form>
<label>Name</label>
<input type='text'>
<label>Gender:</label>
<select id="select">
<option>Male</option>
<option>Female</option>
</select>
<input type='submit'>
</form>
Output
The output of above code is shown below.
Browser Support for HTML form Tag
HTML form Tag is supported by all major browsers including Safari and Internet Explorer.
Global Attributes Support in HTML form Tag
The HTML form Tag supports all Global Attributes.
Event Attributes Support in HTML form Tag
The HTML form Tag supports all Event Attributes.
HTML form Tag Video
Watch our video on HTML form Tag.