写一个页面,支持学生登陆
时间: 2024-04-20 15:26:20 浏览: 9
好的,我可以为您提供一份简单的代码示例,用于实现学生登录页面。请注意,这只是一个示例,您需要根据您的具体需求进行适当的修改。
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="login-container">
<h1>学生登录</h1>
<form>
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required>
<br>
<label for="password">密码:</label>
<input type="password" id="password" name="password" required>
<br>
<input type="submit" value="登录">
</form>
</div>
</body>
</html>
```
CSS 代码(保存为 style.css 文件):
```
.login-container {
width: 300px;
margin: 0 auto;
padding: 20px;
background-color: #f2f2f2;
border: 1px solid #ccc;
border-radius: 5px;
}
h1 {
text-align: center;
}
form {
display: flex;
flex-direction: column;
}
label {
margin-bottom: 10px;
}
input[type=text],
input[type=password] {
padding: 10px;
border-radius: 5px;
border: 1px solid #ccc;
margin-bottom: 20px;
}
input[type=submit] {
background-color: #4CAF50;
color: white;
padding: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
}
input[type=submit]:hover {
background-color: #45a049;
}
```
此代码将生成一个简单的登录表单,要求用户输入用户名和密码,然后单击“登录”按钮。您可以将其与后端代码结合使用,以验证用户凭据并授予他们访问权限。