下面是一个简单的 HTML5 注册表单示例。

<!DOCTYPE html>
<html>
<head>
<title>注册表单</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
}
.container {
max-width: 400px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
label {
display: block;
margin-bottom: 10px;
}
input[type="text"], input[type="password"] {
width: 100%;
padding: 10px;
border-radius: 5px;
border: 1px solid #ccc;
}
input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<h2>注册表单</h2>
<form action="/register" method="post"> <!-- 表单的提交地址和提交方式 -->
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required><br> <!-- 必填项 -->
<label for="email">邮箱:</label>
<input type="email" id="email" name="email" required><br> <!-- 必填且格式正确的邮箱 -->
<label for="password">密码:</label> <!-- 密码输入框不建议前端展示明文密码 -->
<input type="password" id="password" name="password" required><br> <!-- 必填密码 -->
<input type="submit" value="注册"> <!-- 注册按钮 -->
</form> <!-- 结束表单 -->
</div> <!-- 结束容器 -->
</body>
</html>这是一个简单的注册表单,包含了用户名、邮箱和密码的输入字段以及一个注册按钮,在实际开发中,前端不应处理敏感信息(如密码),并且应该遵循最佳的安全实践来保护用户数据,表单的提交地址(action 属性)和提交方式(method 属性)应根据你的后端服务进行相应的配置。






