html css登录注册页面
时间: 2023-09-21 15:07:12 浏览: 42
您可以使用以下示例代码创建一个基本的HTML和CSS登录注册页面:
HTML代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>登录/注册页面</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
<form id="login-form">
<h2>登录</h2>
<input type="text" placeholder="用户名" required>
<input type="password" placeholder="密码" required>
<button type="submit">登录</button>
</form>
<form id="register-form">
<h2>注册</h2>
<input type="text" placeholder="用户名" required>
<input type="email" placeholder="邮箱" required>
<input type="password" placeholder="密码" required>
<button type="submit">注册</button>
</form>
</div>
</body>
</html>
```
CSS代码(style.css):
```css
.container {
width: 300px;
margin: 0 auto;
padding: 20px;
}
form {
margin-bottom: 20px;
}
h2 {
margin-bottom: 10px;
}
input[type="text"],
input[type="email"],
input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
}
button {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
}
```
以上代码创建了一个包含登录和注册表单的容器。每个表单都包含一个标题和几个输入字段。CSS代码用于设置表单和按钮的样式。
请注意,这只是一个基本示例,您可能需要根据自己的需求进行进一步的样式和功能定制。