生成 一段web前端网吧管理系统用户登录和注册界面带背景图片和导航栏的代码
时间: 2024-01-22 18:21:09 浏览: 42
以下是一段简单的HTML和CSS代码,实现了一个带有背景图片和导航栏的用户登录和注册界面。你可以根据自己的需求进行修改和扩展。
```html
<!DOCTYPE html>
<html>
<head>
<title>网吧管理系统登录</title>
<style type="text/css">
body {
background-image: url("background.jpg");
background-size: cover;
background-position: center;
font-family: Arial, sans-serif;
}
.container {
width: 100%;
max-width: 600px;
margin: 0 auto;
padding: 50px 20px;
box-sizing: border-box;
background-color: rgba(255, 255, 255, 0.8);
}
h1 {
text-align: center;
margin-bottom: 50px;
}
form {
display: flex;
flex-direction: column;
align-items: center;
}
input[type="text"],
input[type="password"] {
width: 100%;
margin-bottom: 20px;
padding: 10px;
border: none;
border-radius: 5px;
outline: none;
font-size: 16px;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
padding: 10px;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #3e8e41;
}
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 20px;
background-color: rgba(0, 0, 0, 0.8);
color: white;
}
.navbar a {
color: white;
text-decoration: none;
font-size: 16px;
margin-left: 20px;
}
.navbar a:hover {
color: #4CAF50;
}
</style>
</head>
<body>
<div class="navbar">
<h2>网吧管理系统</h2>
<nav>
<a href="#">首页</a>
<a href="#">关于我们</a>
<a href="#">联系我们</a>
</nav>
</div>
<div class="container">
<h1>用户登录</h1>
<form action="#" method="post">
<label for="username">用户名:</label>
<input type="text" name="username" id="username" required>
<label for="password">密码:</label>
<input type="password" name="password" id="password" required>
<input type="submit" value="登录">
</form>
<hr>
<p>没有账号?点击下面的按钮进行注册。</p>
<a href="#">注册账号</a>
</div>
</body>
</html>
```
在上面的代码中,我们使用了一个 `.navbar` 类来定义导航栏,其中包含网站的标题和若干个导航链接。我们还使用了一个 `.container` 类来定义登录和注册表单的容器,其中包含表单的标题、输入框、提交按钮以及注册链接。我们使用了背景图片来美化页面,还对各个元素进行了样式调整,使其在视觉上更加美观和一致。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)