用css heml帮我做一个登陆注册界面
时间: 2024-01-29 17:03:23 浏览: 23
好的,以下是一个简单的登陆注册界面的 HTML 和 CSS 代码示例:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>登陆/注册</title>
<style>
body {
background-color: #f1f1f1;
font-family: Arial, sans-serif;
}
.container {
margin: 50px auto;
max-width: 500px;
background-color: #ffffff;
border-radius: 5px;
padding: 20px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
}
h2 {
text-align: center;
}
form {
display: flex;
flex-direction: column;
align-items: center;
}
input[type="text"], input[type="password"] {
padding: 10px;
margin: 10px 0;
font-size: 16px;
border: none;
border-radius: 5px;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
width: 100%;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
margin: 10px 0;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
}
input[type="submit"]:hover {
background-color: #3e8e41;
}
.form-group {
display: flex;
flex-direction: column;
width: 100%;
}
.form-group label {
font-weight: bold;
margin-bottom: 5px;
}
.form-group input[type="text"], .form-group input[type="password"] {
margin-top: 5px;
}
</style>
</head>
<body>
<div class="container">
<h2>登陆/注册</h2>
<form>
<div class="form-group">
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required>
</div>
<div class="form-group">
<label for="password">密码:</label>
<input type="password" id="password" name="password" required>
</div>
<input type="submit" value="登陆">
<p>还没有账号?<a href="#">注册</a></p>
</form>
</div>
</body>
</html>
```
在这个例子中,我们创建了一个包含登陆和注册表单的容器(`.container`)。表单中有两个输入框(用户名和密码),以及一个提交按钮和一个注册链接。我们使用 CSS 来设计这个容器,使其看起来更漂亮和现代化。
希望这个例子对你有所帮助!