HTML5 form example, How to implement form tag in html document.


 

HTML5 form example, How to implement form tag in html document.

In this tutorial, you will see the use of form tag in HTML5.

In this tutorial, you will see the use of form tag in HTML5.

HTML5 form example, How to implement form tag in html document.

HTML form tag is provides form to user. It support different controls. These controls is input controls, which is use for input user data. A HTML form always starts <form> tag. It is most important for each and every website, because it is use for registration , order, searching etc.
Html form is a pair tag.
OR
Form is a container for containing controls like text, button, checkbox, radio button etc. Form take information from user and process them.

Attributes of form:
Attribute of form tag provides significant information about the form for the browser. There are following attributes..
1- accept-charset
2-action
3- autocomplete
4-enctype
5-method
6-name
7-novalidate
8-target

Declaration Syntax :

Declaration syntax of form in HTML5.

                           <form attributes> controls</form>

Example of <form> in HTML5:

Code:
formTag.html
<!DOCTYPE html >
<html>
<head><title>Untitled 1</title></head>
<body>
<form name="form1">
<table style="width: 49%">
<caption><strong>Employee registration form</strong></caption>
<tr> <td> <label>EmpName </label>&nbsp;</td>
<td><input type="text" name="text" /></td></tr>
<tr><td><label>EmpId &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; </label></td><td><input type="text" name="Empid" />
</td></tr><tr><td> <label>Age&nbsp;&nbsp;&nbsp; </label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td><td>
<input type="text" name="age" /></td></tr> <tr>
<td><button type="submit" value="Submit" >Submit</button></td>
<td> <button type="reset" value="Reset">Reset</button>
</td></tr></table>
</form>
</body>
</html>
Output:

Download this code

Difference Between HTML5 and HTML4.01:

The form tag is available in both HTML5 and HTML4.01. But there is some attribute in HTML5, that is not supported by HTML4.01.

Ads