网页设计登录注册页面代码
时间: 2024-01-03 14:05:13 浏览: 28
以下是一个简单的HTML登录注册页面的代码示例:
```html
<!DOCTYPE html>
<html>
<head>
<title>Login/Register Page</title>
<style>
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.form {
width: 300px;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
.form input {
width: 100%;
margin-bottom: 10px;
padding: 10px;
}
.form button {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none; border-radius: 5px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<form class="form">
<h2>Login</h2>
<input type="text" placeholder="Username" required>
<input type="password" placeholder="Password" required>
<button type="submit">Login</button>
<h2>Register</h2>
<input type="text" placeholder="Username" required>
<input type="password" placeholder="Password" required>
<button type="submit">Register</button>
</form>
</div>
</body>
</html>
```
这段代码创建了一个简单的登录注册页面。页面使用flex布局将表单居中显示,并使用CSS样式设置了表单的样式。登录和注册部分分别使用了`<h2>`标签作为标题,`<input>`标签用于输入用户名和密码,`<button>`标签用于提交表单。