写一个登录/注册界面布局代码
时间: 2024-01-24 10:04:51 浏览: 27
这里是一个简单的登录/注册界面布局代码示例,使用HTML和CSS编写:
HTML代码:
```
<!DOCTYPE html>
<html>
<head>
<title>Login/Register Page</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
<div class="form-container">
<div class="form-title">
<h1>Login/Register</h1>
</div>
<div class="form-body">
<form>
<label for="username">Username:</label>
<input type="text" id="username" name="username" placeholder="Enter your username">
<label for="password">Password:</label>
<input type="password" id="password" name="password" placeholder="Enter your password">
<button type="submit" class="login-btn">Login</button>
</form>
<div class="separator">
<span>or</span>
</div>
<form>
<label for="reg-username">Username:</label>
<input type="text" id="reg-username" name="reg-username" placeholder="Enter your username">
<label for="reg-email">Email:</label>
<input type="email" id="reg-email" name="reg-email" placeholder="Enter your email">
<label for="reg-password">Password:</label>
<input type="password" id="reg-password" name="reg-password" placeholder="Enter your password">
<button type="submit" class="register-btn">Register</button>
</form>
</div>
</div>
</div>
</body>
</html>
```
CSS代码:
```
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f2f2f2;
}
.container {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
.form-container {
background-color: #fff;
border-radius: 5px;
box-shadow: rgba(0,0,0,0.3) 0px 3px 8px;
padding: 20px;
width: 400px;
}
.form-title {
text-align: center;
margin-bottom: 20px;
}
.form-body form {
display: flex;
flex-direction: column;
}
.form-body label {
margin-bottom: 5px;
font-size: 16px;
font-weight: bold;
}
.form-body input {
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
}
.form-body button {
padding: 10px;
background-color: #4CAF50;
color: #fff;
border: none;
border-radius: 4px;
font-size: 16px;
cursor: pointer;
}
.separator {
display: flex;
align-items: center;
justify-content: center;
margin: 20px 0;
}
.separator span {
font-size: 18px;
font-weight: bold;
margin: 0 10px;
}
.login-btn {
background-color: #4CAF50;
}
.register-btn {
background-color: #008CBA;
}
```