图书管理系统登录注册主页面代码
时间: 2023-09-11 18:11:30 浏览: 42
以下是一个简单的图书管理系统的登录注册主页面代码示例:
```html
<!DOCTYPE html>
<html>
<head>
<title>图书管理系统</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
<div class="header">
<h1>图书管理系统</h1>
</div>
<div class="content">
<div class="login">
<h2>登录</h2>
<form action="login.php" 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>
</div>
<div class="register">
<h2>注册</h2>
<form action="register.php" 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>
<label for="confirm_password">确认密码:</label>
<input type="password" name="confirm_password" id="confirm_password" required>
<input type="submit" value="注册">
</form>
</div>
</div>
</div>
</body>
</html>
```
该页面包括一个标题、一个登录表单和一个注册表单,分别通过 `action` 属性指向登录和注册的处理页面 `login.php` 和 `register.php`。此外,使用了一个简单的 CSS 文件 `style.css` 来美化页面。
下面是 `style.css` 的代码示例:
```css
.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.header {
text-align: center;
margin-bottom: 20px;
}
.login, .register {
display: inline-block;
vertical-align: top;
width: 45%;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
box-shadow: 0 0 5px #ccc;
}
.login h2, .register h2 {
margin-top: 0;
}
form {
display: flex;
flex-direction: column;
align-items: flex-start;
}
label {
display: block;
margin-bottom: 10px;
}
input[type="text"], input[type="password"] {
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
margin-bottom: 20px;
}
input[type="submit"] {
padding: 10px;
background-color: #337ab7;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #286090;
}
```
该 CSS 文件定义了容器、标题、登录和注册表单的样式,并使表单使用 Flexbox 布局。还定义了鼠标悬停时按钮的颜色变化效果。
注:该示例代码中的 `login.php` 和 `register.php` 是需要自己编写的处理登录和注册的 PHP 文件。