web登陆注册界面设计代码
时间: 2023-09-04 08:10:12 浏览: 48
这是一个简单的web登陆注册界面设计代码,使用HTML和CSS实现:
```html
<!DOCTYPE html>
<html>
<head>
<title>Login and Registration</title>
<style>
body {
background-color: #f2f2f2;
font-family: Arial, sans-serif;
}
.container {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
margin-top: 50px;
align-items: center;
height: 500px;
}
.box {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: #fff;
border-radius: 5px;
box-shadow: 0px 0px 10px 0px #dcdcdc;
padding: 30px;
width: 400px;
height: 400px;
}
h1 {
font-size: 36px;
margin-bottom: 30px;
}
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
}
button[type=submit] {
background-color: #4CAF50;
color: white;
padding: 12px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
button[type=submit]:hover {
background-color: #45a049;
}
.error {
color: red;
font-size: 14px;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="container">
<div class="box">
<h1>Login</h1>
<form action="#" method="POST">
<label for="username">Username:</label>
<input type="text" id="username" name="username" placeholder="Enter username">
<label for="password">Password:</label>
<input type="password" id="password" name="password" placeholder="Enter password">
<button type="submit">Login</button>
<div class="error">Error message goes here</div>
</form>
</div>
<div class="box">
<h1>Register</h1>
<form action="#" method="POST">
<label for="username">Username:</label>
<input type="text" id="username" name="username" placeholder="Enter username">
<label for="email">Email:</label>
<input type="text" id="email" name="email" placeholder="Enter email">
<label for="password">Password:</label>
<input type="password" id="password" name="password" placeholder="Enter password">
<button type="submit">Register</button>
<div class="error">Error message goes here</div>
</form>
</div>
</div>
</body>
</html>
```
这个代码包含两个部分,一个是登陆的表单,一个是注册的表单。每个表单都包括三个输入框和一个提交按钮。CSS样式定义了页面的布局和表单元素的样式。