用bootstrap写一个买小说的首页
时间: 2023-08-22 20:03:26 浏览: 180
bootstrap首页制作
5星 · 资源好评率100%
好的,以下是一个简单的 Bootstrap 风格的小说购买首页示例:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>小说购买首页</title>
<!-- 引入 Bootstrap 样式 -->
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.1.3/css/bootstrap.min.css" />
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">小说购买平台</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">首页</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">分类</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">购物车</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">我的订单</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container my-4">
<div class="row">
<div class="col-md-8">
<h1>精选小说</h1>
<div class="row row-cols-1 row-cols-md-3 g-4">
<div class="col">
<div class="card h-100">
<img src="https://picsum.photos/300/200" class="card-img-top" alt="..." />
<div class="card-body">
<h5 class="card-title">小说标题1</h5>
<p class="card-text">这是一部非常好的小说,值得一读。</p>
<div class="d-flex justify-content-between align-items-center">
<button type="button" class="btn btn-sm btn-outline-secondary">加入购物车</button>
<small class="text-muted">$9.99</small>
</div>
</div>
</div>
</div>
<div class="col">
<div class="card h-100">
<img src="https://picsum.photos/300/200" class="card-img-top" alt="..." />
<div class="card-body">
<h5 class="card-title">小说标题2</h5>
<p class="card-text">这是一部非常好的小说,值得一读。</p>
<div class="d-flex justify-content-between align-items-center">
<button type="button" class="btn btn-sm btn-outline-secondary">加入购物车</button>
<small class="text-muted">$9.99</small>
</div>
</div>
</div>
</div>
<div class="col">
<div class="card h-100">
<img src="https://picsum.photos/300/200" class="card-img-top" alt="..." />
<div class="card-body">
<h5 class="card-title">小说标题3</h5>
<p class="card-text">这是一部非常好的小说,值得一读。</p>
<div class="d-flex justify-content-between align-items-center">
<button type="button" class="btn btn-sm btn-outline-secondary">加入购物车</button>
<small class="text-muted">$9.99</small>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<h2>推荐小说</h2>
<ul class="list-group">
<li class="list-group-item d-flex justify-content-between align-items-center">
小说标题1
<span class="badge bg-primary rounded-pill">$9.99</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
小说标题2
<span class="badge bg-primary rounded-pill">$9.99</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
小说标题3
<span class="badge bg-primary rounded-pill">$9.99</span>
</li>
</ul>
</div>
</div>
</div>
<!-- 引入 Bootstrap JS 文件 -->
<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.1.3/js/bootstrap.min.js"></script>
</body>
</html>
```
这个示例中包含了一个顶部导航栏,一个精选小说的卡片列表和一个推荐小说的列表。可以根据实际需要进行修改。
阅读全文