表单标签
1. <form>标签
<form>标签用于定义一个表单,包含所有用户输入的控件。表单可以包含文本框、单选按钮、复选框、下拉菜单等。
常用属性:
action:指定表单数据提交的URL。method:指定表单数据提交的方法,常用的有GET和POST。enctype:指定表单数据在提交时的编码类型,常用值有application/x-www-form-urlencoded(默认)和multipart/form-data(用于文件上传)。
示例:
<form action="/submit" method="post">
<!-- 表单控件 -->
</form>
2. <input>标签
<input>标签用于创建各种输入控件,如文本框、单选按钮、复选框、文件上传等。
常用属性:
type:指定输入控件的类型,常用值有text、password、radio、checkbox、file、submit、reset等。name:指定输入控件的名称,用于在提交表单时标识该控件的数据。value:指定输入控件的初始值。placeholder:指定输入控件的占位符文本。required:指定输入控件为必填项。
示例:
<form action="/submit" method="post">
<label for="username">用户名:</label>
<input type="text" id="username" name="username" placeholder="请输入用户名" required><br>
<label for="password">密码:</label>
<input type="password" id="password" name="password" placeholder="请输入密码" required><br>
<label for="gender">性别:</label>
<input type="radio" id="

最低0.47元/天 解锁文章
1904

被折叠的 条评论
为什么被折叠?



