学习如何创建和使用HTML表单
HTML表单用于收集用户输入,主要包括以下元素:
一个基本的HTML表单包含以下元素:
<form action="/submit" method="post">
<div class="form-group">
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required>
</div>
<div class="form-group">
<label for="password">密码:</label>
<input type="password" id="password" name="password" required>
</div>
<button type="submit">提交</button>
</form>
HTML5提供了多种输入类型:
HTML提供了多种选择控件:
HTML5提供了内置的表单验证功能: