1.bootstrap不需要思考,只需要在官网上copy就行
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>案例2:书籍类分类</title>
<!-- 引入Bootstrap -->
<link rel="stylesheet" type="text/css" href="css/bootstrap.css" />
<!-- 支持手机端 -->
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<style type="text/css">
.navbar-collapse {
flex-grow: 0;
/* 在固定容器中 1代表性扩大占用父容器剩余空间0代表不占用 */
}
.form-group{
width: 300px;/* 高度 */
margin-left: auto;/* 左间距自适应 自动 */
margin-right: auto;/* 右间距自适应 自动 */
margin-top: 31px;/* 100-38=62/2=31 */
}
.ss{
height: 100px;/* 宽度 */
margin-top: 30px;/* 上间距 */
background-color: #DCDCDC;/* 背景颜色 */
}
.list-group,.media{
margin-top: 31px;
}
.media-body p{
line-height:15px;
letter-spacing:5px;
}
.media-body p button{
height:31px;
line-height:10px;
}
</style>
</head>
<body>
<!-- 导航区域:导航条组件 -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container">
<a class="navbar-brand" href="#">您好,欢迎来到牛马世界</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-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 active">
<a class="nav-link" href="#">首页<span class="sr-only">(current)</span></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">
<!-- 第一行 1列:搜索区域 -->
<div class="row ss" >
<div class="col">
<!-- 搜索区域 -->
<form>
<div class="form-group">
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="书籍名" aria-label="Recipient's username"
aria-describedby="button-addon2">
<div class="input-group-append">
<button class="btn btn-primary" type="button" id="button-addon2">查询</button>
</div>
</div>
</div>
</form>
</div>
</div>
<!-- 第二行 -->
<div class="row" >
<div class="col-3">
<!-- 左3为书籍分类 -->
<div class="list-group">
<button type="button" class="list-group-item list-group-item-action active" aria-current="true">
书籍分类
</button>
<button type="button" class="list-group-item list-group-item-action">言情</button>
<button type="button" class="list-group-item list-group-item-action">玄幻</button>
<button type="button" class="list-group-item list-group-item-action">都市</button>
<button type="button" class="list-group-item list-group-item-action">惊悚</button>
<button type="button" class="list-group-item list-group-item-action">科幻</button>
<button type="button" class="list-group-item list-group-item-action">校园</button>
<button type="button" class="list-group-item list-group-item-action">热血</button>
<button type="button" class="list-group-item list-group-item-action">末世</button>
<button type="button" class="list-group-item list-group-item-action">武侠</button>
</div>
</div>
<div class="col-9" >
<div class="media">
<img src="img/1.png" class="mr-3" width:"100px" alt="...">
<div class="media-body">
<h5 class="mt-0">冷间谍</h5>
<p>书籍价格:9.9</p>
<p>书籍作者:黄桃</p>
<p>书籍出版社:牛逼出版社</p>
<p>书籍内容:黄涛的爱情故事</p>
<p>
<button class="btn btn-danger">加入购物车</button>
<button class="btn btn-danger">我要结算</button>
</p>
</div>
</div>
<hr / color="red">
<div class="media">
<img src="img/1.png" class="mr-3" width:"100px" alt="...">
<div class="media-body">
<h5 class="mt-0">冷间谍</h5>
<p>书籍价格:9.9</p>
<p>书籍作者:黄桃</p>
<p>书籍出版社:牛逼出版社</p>
<p>书籍内容:黄涛的爱情故事</p>
<p>
<button class="btn btn-danger">加入购物车</button>
<button class="btn btn-danger">我要结算</button>
</p>
</div>
</div>
<hr / color="red">
<div class="media">
<img src="img/1.png" class="mr-3" width:"100px" alt="...">
<div class="media-body">
<h5 class="mt-0">冷间谍</h5>
<p>书籍价格:9.9</p>
<p>书籍作者:黄桃</p>
<p>书籍出版社:牛逼出版社</p>
<p>书籍内容:黄涛的爱情故事</p>
<p>
<button class="btn btn-danger">加入购物车</button>
<button class="btn btn-danger">我要结算</button>
</p>
</div>
</div>
<hr / color="red">
</div>
</div>
</div>
<!-- 引入jQuery的类库 -->
<script src="js/jquery-3.3.1.js" type="text/javascript" charset="utf-8"></script>
<!-- 引入Bootstrap -->
<script src="js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>