用bootstrap写一个登陆页面,登录框不要太大
时间: 2024-06-06 13:10:54 浏览: 64
基于Bootstrap开发的一个登录页面
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<style>
body {
background-color: #f1f1f1;
}
.login-form {
margin-top: 50px;
background-color: #ffffff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}
.login-form input[type="text"], .login-form input[type="password"] {
border-radius: 0;
border: none;
border-bottom: 1px solid #cccccc;
}
.login-form input[type="text"]:focus, .login-form input[type="password"]:focus {
border-color: #1e90ff;
box-shadow: none;
}
.login-form button[type="submit"] {
background-color: #1e90ff;
border: none;
border-radius: 3px;
padding: 10px 20px;
color: #ffffff;
cursor: pointer;
}
.login-form button[type="submit"]:hover {
background-color: #0066cc;
}
</style>
</head>
<body>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6">
<div class="login-form">
<h2 class="text-center">Login</h2>
<form action="#" method="post">
<div class="form-group">
<label for="username">Username:</label>
<input type="text" class="form-control" id="username" name="username" required>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<div class="form-group text-center">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
</div>
</div>
</div>
</div>
</body>
</html>
阅读全文