Form tag
label |
description |
form |
Form definition for user input |
input |
Define the input field |
textarea |
Defined text field (a multi-line input control) |
label |
Defines the label input element, typically enter a title |
fieldset |
It defines a set of related form elements, comprising a frame and use them |
legend |
It defines the title of the fieldset element |
select |
It defines the drop-down list of options |
OPTGROUP |
Defined set of options |
option |
Defined drop-down list of options |
button |
Define a click of a button |
datalist |
Enter a specified list of predefined control options |
keygen |
Defined form key pair generator field |
output |
Define a calculation |
The sample code
Form with border
<!DOCTYPE html>
<html>
<body>
<form action="">
<fieldset>
<legend>Personal information:</legend>
Name: <input type="text" size="30"><br>
E-mail: <input type="text" size="30"><br>
Date of birth: <input type="text" size="10">
</fieldset>
</form>
</body>
</html>
With input box and submit form button
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>W3Cschool(w3cschool.cn)</title>
</head>
<body>
<form action="demo-form.php" method="post">
First name: <input type="text" name="FirstName" value="Mickey"><br>
Last name: <input type="text" name="LastName" value="Mouse"><br>
<input type="submit" value="提交">
</form>
<p>点击"提交"按钮,表单数据将被发送到服务器上的“demo-form.php”。</p>
</body>
</html>