用HTML做登录注册页面
时间: 2023-09-18 12:10:22 浏览: 38
好的,以下是一个简单的 HTML 用户登录和注册页面的示例代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>用户登录和注册</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
/* 样式可以根据需求自行修改 */
form {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 50px;
}
input[type="text"], input[type="password"] {
padding: 10px;
margin-bottom: 20px;
width: 300px;
border-radius: 5px;
border: 1px solid #ccc;
}
input[type="submit"] {
padding: 10px 20px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #0069d9;
}
h1 {
text-align: center;
margin-bottom: 50px;
}
</style>
</head>
<body>
<h1>用户登录和注册</h1>
<div>
<form action="/login" method="post">
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required>
<label for="password">密码:</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="登录">
</form>
<form action="/register" method="post">
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required>
<label for="password">密码:</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="注册">
</form>
</div>
</body>
</html>
```
这个页面有两个表单,一个用于登录,一个用于注册。表单中都有一个用户名和一个密码的输入框,以及一个提交按钮。表单提交后将会向 `/login` 或 `/register` 发送 POST 请求,具体实现需要后端来处理。
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)