利用web前端生成一段网吧管理系统用户登入和注册界面带背景图片和导航栏的代码
时间: 2024-01-22 13:21:16 浏览: 61
下面是一段简单的网吧管理系统用户登录和注册界面的前端代码,包含背景图片和导航栏:
```html
<!DOCTYPE html>
<html>
<head>
<title>网吧管理系统</title>
<style>
body {
background-image: url("background.jpg");
background-size: cover;
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}
.form {
background-color: rgba(255, 255, 255, 0.8);
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
width: 300px;
text-align: center;
}
.form h2 {
margin-top: 0;
}
.form input {
display: block;
width: 100%;
padding: 10px;
margin-bottom: 10px;
border-radius: 5px;
border: none;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
font-size: 16px;
color: #555;
}
.form button {
background-color: #4CAF50;
color: white;
padding: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}
.form button:hover {
background-color: #3e8e41;
}
.navbar {
background-color: #333;
position: fixed;
top: 0;
left: 0;
right: 0;
height: 50px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}
.navbar a {
color: white;
text-decoration: none;
font-size: 18px;
margin-right: 20px;
}
.navbar a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="navbar">
<a href="#">网吧管理系统</a>
<a href="#">登录</a>
<a href="#">注册</a>
</div>
<div class="container">
<div class="form">
<h2>用户登录</h2>
<input type="text" placeholder="请输入用户名">
<input type="password" placeholder="请输入密码">
<button>登录</button>
</div>
<div class="form">
<h2>用户注册</h2>
<input type="text" placeholder="请输入用户名">
<input type="password" placeholder="请输入密码">
<input type="password" placeholder="请再次输入密码">
<button>注册</button>
</div>
</div>
</body>
</html>
```
在这段代码中,我们使用了 `background-image` 属性来设置背景图片,并使用 `background-size: cover` 属性来让图片充满整个页面。我们还使用了一个称为 flexbox 的技术来水平和垂直居中登录和注册表单。导航栏使用了一个灰色的背景,固定在页面的顶部,并使用了 `position: fixed` 属性来实现。