用bootstrap做登录注册页面
时间: 2023-09-19 14:09:27 浏览: 41
首先,你需要在你的项目中添加Bootstrap,可以通过CDN或下载并引入本地文件的方式添加。接下来,你可以使用Bootstrap提供的表单和按钮组件来创建你的登录和注册页面。
下面是一个简单的示例代码:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login/Register Page</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h1>Login</h1>
<form>
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username">
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<hr>
<h1>Register</h1>
<form>
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username">
</div>
<div class="mb-3">
<label for="email" class="form-label">Email</label>
<input type="email" class="form-control" id="email">
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
```
这里使用了容器(container)来放置表单。每个表单包含了一些输入框和一个提交按钮。Bootstrap的样式会自动应用到这些元素上。你可以根据自己的需要来调整样式和布局。
注意,这只是一个示例代码,你需要自己处理表单数据提交和验证等问题。