May 29, 2021 Article blog
The writing of form pages is an important part of front-end development, which is involved when registering for login and filling in information. So W3Cschool is a small compilation for you to introduce the simple form writing.
Let's start by looking at some of the common form elements:
The text field |
Text fields are set by
<input type="text">
labels, and are used when users type letters, numbers, and so on in a form.
|
The password field |
The password field is defined by the label
<input type="password">
|
radio button |
the form radio option is defined
<input type="radio">
label.
|
Check box |
<input type="checkbox">
defines the check box.
The user needs to choose one or more of several of the given choices.
|
Submit button | When the user clicks the confirmation button, the contents of the form are transferred to another file. |
Specific effect:
This is the most basic form effect, including the five form elements mentioned above. Let's look at the specific code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>简单表单 - 编程狮(w3cschool.cn)</title>
</head>
<body>
<form action="">
用户名:<input type="text" name="username"><br>
密码:<input type="password" name="password"><br>
性别:<input type="radio" name="sex" value="女">女
<input type="radio" name="sex" value="男">男<br>
爱好:<input type="checkbox" name="like" value="运动">运动
<input type="checkbox" name="like" value="画画">画画
<input type="checkbox" name="like" value="阅读">阅读<br>
<input type="submit" name="确定登录">
<input type="reset" name="重新填写">
</body>
</html>
That's all HTML does with how to write simple forms. I f you want to make the page you're developing more beautiful, you can add label styles, background diagrams, and more. Not here in the narrative, please students practice their own development.