高级一点的图书馆登录页面前端代码HTML最好有背景图
时间: 2024-02-19 07:59:45 浏览: 16
以下是一个高级一点的图书馆登录页面的前端代码HTML,包括一个带有背景图的登录表单,以及一个响应式的设计:
```html
<!DOCTYPE html>
<html>
<head>
<title>图书馆登录</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
background-image: url('https://images.unsplash.com/photo-1521747116042-5a810fda9662');
background-size: cover;
background-position: center;
height: 100vh;
}
.container {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
padding: 20px;
box-sizing: border-box;
}
form {
background-color: rgba(255, 255, 255, 0.8);
border-radius: 5px;
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.2);
padding: 20px;
max-width: 500px;
width: 100%;
margin: 0 auto;
}
input[type=text], input[type=password] {
padding: 10px;
margin: 10px 0;
display: block;
width: 100%;
border: none;
border-radius: 3px;
box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.1);
}
input[type=submit] {
background-color: #4CAF50;
color: #fff;
border: none;
padding: 10px;
border-radius: 3px;
cursor: pointer;
margin-top: 10px;
}
input[type=submit]:hover {
background-color: #3e8e41;
}
@media screen and (max-width: 500px) {
form {
max-width: 100%;
}
}
</style>
</head>
<body>
<div class="container">
<form action="#" method="post">
<h2>图书馆登录</h2>
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required>
<label for="password">密码:</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="登录">
</form>
</div>
</body>
</html>
```
这个页面使用`background-image`属性添加了一个美丽的背景图,并使用`background-size`和`background-position`属性来调整其大小和位置。CSS样式使用了响应式设计,使页面在小屏幕上也能很好地显示。