Bootstrap,今天我用了一下他的其他的代码,分享一下
实现的效果图如下:
如果单纯自己打的话可能打的时间有点久,因为样式要一个个调,但是使用Bootstrap前端框架就只需要修改一下就行,效率提升了非常多
下面的这些代码都是copy的:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>案例四</title>
<link rel="stylesheet" href="css/bootstrap.css" />
<style>
.navbar-collapse{
flex-grow: 0;
}
.input-group {
margin-left: auto;
margin-right: auto;
margin-top: 30px;
}
.ss{
height: 100px;
margin-top: 30px;
background-color: #0056B3;
}
.list-group,#carouselExampleIndicators{
margin-top: 30px;
}
.carousel-indicators li{
background-color: blue;
}
.xxx{
margin-top: 30px;
background-image: url(img/title_bj.png);
background-repeat: no-repeat;
color: white;
font-size: 18px;
padding-left: 20px;
margin-bottom: 20px;
}
</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 ">我的购物车</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- 三个 -->
<div class="container">
<div class="row ss">
<div class="col" style="background-color: pink;">
<!-- 搜索区-->
<form class="form-inline">
<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>
</form>
</div>
</div>
<div class="row">
<div class="col-3">
<div class="list-group">
<a href="#" class="list-group-item list-group-item-action active" aria-current="true">
书籍分类
</a>
<a href="#" class="list-group-item list-group-item-action">爱情</a>
<a href="#" class="list-group-item list-group-item-action">科幻</a>
<a href="#" class="list-group-item list-group-item-action">系统</a>
<a class="list-group-item list-group-item-action ">校园</a>
</div>
</div>
<div class="col-9" >
<!-- 新书上架等 -->
<div class="row">
<div class="col">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="3"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="img/lb1.png" class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="img/lb2.jpg" class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="img/lb3.jpg" class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="img/lb4.jpeg" class="d-block w-100" alt="...">
</div>
</div>
<button class="carousel-control-prev" type="button" data-target="#carouselExampleIndicators" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-target="#carouselExampleIndicators" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</button>
</div>
</div>
</div>
<div class="xxx">
新书上架
</div>
<div class="row">
<div class="col">
<figure class="figure">
<img src="img/1.png" class="figure-img img-fluid rounded" alt="...">
<figcaption class="figure-caption">冷</figcaption>
</figure>
</div>
<div class="col">
<figure class="figure">
<img src="img/pic_c3.png" class="figure-img img-fluid rounded" alt="...">
<figcaption class="figure-caption">冷</figcaption>
</figure>
</div>
<div class="col">
<figure class="figure">
<img src="img/2.png" class="figure-img img-fluid rounded" alt="...">
<figcaption class="figure-caption">冷</figcaption>
</figure>
</div>
<div class="col">
<figure class="figure">
<img src="img/3.png" class="figure-img img-fluid rounded" alt="...">
<figcaption class="figure-caption">冷</figcaption>
</figure>
</div>
<div class="col">
<figure class="figure">
<img src="img/4.png" class="figure-img img-fluid rounded" alt="...">
<figcaption class="figure-caption">冷</figcaption>
</figure>
</div>
</div>
<div class="xxx">
热门书籍
</div>
<div class="row">
<div class="col">
<figure class="figure">
<img src="img/6.png" class="figure-img img-fluid rounded" alt="...">
<figcaption class="figure-caption">冷</figcaption>
</figure>
</div>
<div class="col">
<figure class="figure">
<img src="img/7.png" class="figure-img img-fluid rounded" alt="...">
<figcaption class="figure-caption">冷</figcaption>
</figure>
</div>
<div class="col">
<figure class="figure">
<img src="img/8.png" class="figure-img img-fluid rounded" alt="...">
<figcaption class="figure-caption">冷</figcaption>
</figure>
</div>
<div class="col">
<figure class="figure">
<img src="img/9.png" class="figure-img img-fluid rounded" alt="...">
<figcaption class="figure-caption">冷</figcaption>
</figure>
</div>
<div class="col">
<figure class="figure">
<img src="img/pic_c10.png" class="figure-img img-fluid rounded" alt="...">
<figcaption class="figure-caption">冷</figcaption>
</figure>
</div>
</div>
</div>
</div>
</div>
<script src="js/jquery-3.3.1.js"></script>
<script src="js/bootstrap.js"></script>
</body>
</html>