Bootstrap03

大家好!今天又来到了我们有空就分享的博客时间了!

今天还是延续之前的bootstrap的讲,

这篇也是最后一篇的bootstrap的分享,大家且看且点赞哈!

话不多说,先上图!

如上图所示:今天我们所讲的也是功能,通过案例的分享,希望大家能熟用!

    今天所讲的功能有:

  1. 组件:媒体对象-Media object
  2. 页面内容:表格-Table
  3. 组件:模态框-Modal
  4. 扩展内容-图标

咱们先看界面效果,代码在后面一起给奥!(代码有很多都是在bootstrap中文文档里cope的)

大家在学习bootstrap时可以一边看博主的文章一边查阅中文文档一起学习哦! 

网址:Bootstrap v4 中文文档 · Bootstrap 是全球最受欢迎的 HTML、CSS 和 JS 框架,用于开发响应式布局、移动设备优先的 WEB 项目。 | Bootstrap 中文网Bootstrap 是全球最受欢迎的 HTML、CSS 和 JS 框架,用于开发响应式布局、移动设备优先的 WEB 项目。https://v4.bootcss.com/

本章知识点用到的js、css以及font有:

(font是之前的那个bootstrap下载后里面的文件夹——直接copy过来就可以了)

 

一、案例1:实现搜索书籍页面(媒体对象-Media object

 

二、案例2:实现购物车页面布局(表格-Table

 

三、案例3:实现购物车页面订单信息(模态框-Modal

 案例二、三的购物车页面代码:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>案例3:实现购物车页面订单信息</title>
		<!-- 支持手机端 -->
		<meta name="viewport"
			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<!-- 先引入Bootstrap的CSS -->
		<link rel="stylesheet" type="text/css" href="css/bootstrap.css" />
		<style type="text/css">
			.navbar-collapse {
				flex-grow: 0;
				/* 1代表弹性自动占用父容器剩余空间  0代表不占用 */
			}

			.ss {
				height: 100px;
				background-color: #DCDCDC;
				margin-top: 20px;
				/* 上间距 */

			}

			.form-group {
				width: 300px;
				margin-left: auto;
				/* 左间距 自适应 */
				margin-right: auto;
				/* 右间距 自适应 */
				margin-top: 31px;
				/* (100-38)/2 */
			}

			.list-group {
				margin-top: 30px;
				/* 上间距 */
			}

			.list-group,
			table {
				margin-top: 30px;
				/* 上间距 */
			}

			/* 悬停表格 表头 字体为白色 */
			.table-hover thead {
				color: white;
			}

			/* 悬停表单 每一行 文本框中的文字居中 字体居中*/
			.table-hover tr,.table-hover tr td input,.xxx {
				text-align: center;
			}
			.xxx button{
				height: 30px;/* 高度 */
				line-height: 10px;/* 行高 */
			}
		</style>
	</head>
	<body>
		
		<!-- Modal的HTML代码 -->
		<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
		  <div class="modal-dialog modal-dialog-centered">
		    <div class="modal-content">
		      <div class="modal-header">
		        <h5 class="modal-title" id="exampleModalLabel">订单详情</h5>
		        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
		          <span aria-hidden="true">&times;</span>
		        </button>
		      </div>
		      <div class="modal-body">
		        订单信息
		      </div>
		      <div class="modal-footer">
		        <button type="button" class="btn btn-primary">确定</button>
		        <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
		      </div>
		    </div>
		  </div>
		</div>
		<!-- 导航条助件 -->
		<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">
							<!-- disabled禁用-->
							<a class="nav-link" href="#">我的购物车</a>
						</li>
					</ul>
				</div>
			</div>
		</nav>
		<!-- 栅格系统实现首页框架 -->
		<div class="container">
			<!-- 第一行:搜索区域 -->
			<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">
						<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 disabled">为二</a>
					</div>
				</div>
				<div class="col-9">
					<!-- 右9-轮播图&新书上架&热门书籍 -->
					<table class="table table-hover">
						<thead class="bg-primary">
							<tr>
								<th scope="col">书籍名称</th>
								<th scope="col">单价</th>
								<th scope="col">购买数量</th>
								<th scope="col">小计</th>
								<th scope="col">操作</th>
							</tr>
						</thead>
						<tbody>
							<tr>
			  			<th scope="row">冷间谍</th>
								<td>20.4</td>
								<td><input value="2"></td>
								<td>42.1</td>
								<td><a href="#">删除</a></td>
							</tr>
							<tr>
								<th scope="row">第一世界</th>
								<td>20.4</td>
								<td><input value="2"></td>
								<td>42.1</td>
								<td><a href="#">删除</a></td>
							</tr>
							<tr>
								<th scope="row">家和万事兴</th>
								<td>20.4</td>
								<td><input value="2"></td>
								<td>42.1</td>
								<td><a href="#">删除</a></td>
							</tr>
						</tbody>
					</table>
					<p class="xxx">
						<button class="btn btn-danger">清空购物车</button>
						<button class="btn btn-success">继续购物</button>
						<button class="btn btn-primary"data-toggle="modal" data-target="#exampleModal">点我结算</button>
					</p>
				</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>

四、案例4:图标组件的使用(扩展内容-图标

 图上的那些购物车及其轮播图上的左右键都是在bootstrap里的图标库找的图标

 大家有想要的图标都可以在里面查找哦!

案例一、四的代码:


<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>案例4:图标组件的使用</title>
		<!-- 支持手机端 -->
		<meta name="viewport"
			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<!-- 先引入Bootstrap的CSS -->
		<link rel="stylesheet" type="text/css" href="css/bootstrap.css" />
		<!-- 引入bootstrap的图标样式 -->
		<link rel="stylesheet" type="text/css" href="font/bootstrap-icons.css"/>
		<style type="text/css">
			.navbar-collapse {
				flex-grow: 0;
				/* 1代表弹性自动占用父容器剩余空间  0代表不占用 */
			}
			.ss{
				height: 100px;/* 高度 */
				background-color: #DCDCDC;
				margin-top: 20px;/* 上间距 */
				
			}
			.form-group{
				width: 300px;
				margin-left: auto;/* 左间距 自适应 */
				margin-right: auto;/* 右间距 自适应 */
				margin-top: 31px;/* (100-38)/2 */
			}
			/* 画像 */
			.figure{
				text-align: center;/* 水平居中 */
				margin-top:20px ;/* 上间距 */
			}
			
			/* 列表组 轮播图*/
			.list-group,#carouselExampleIndicators{
				margin-top:30px ;/* 上间距 */
			}
			/* 指示灯样式 */
			.carousel-indicators li{
				background-color: blue;
			}
			/* 新书上架=热门书籍 */
			.xxx{
				background-image: url(img/title_bj.png);/* 背景效果 */
				background-repeat: no-repeat;/* 不平铺 */
				color: white;/* 字体颜色 */
				font-size: 20px;/* 上间距 */
				padding-left: 18px;/* 左内间距 */
				
				
			}
		</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">
				 		<!-- disabled禁用-->
							<a class="nav-link" href="#">我的购物车</a>
						</li>
					</ul>
				</div>
			</div>
		</nav>
		<!-- 栅格系统实现首页框架 -->
		<div class="container">
			<!-- 第一行:搜索区域 -->
			<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"><i class="bi bi-search text-white"></i></button>
								</div>
				  	</div>
						</div>
					</form>
				</div>
			</div>
			<!-- 第二行-->
			<div class="row">
				<div class="col-3">
					<!-- 左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 disabled">为二</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 disabled">微软</a>
					</div>
				</div>
				<div class="col-9" style="background-color: white ">
					<!-- 右9-轮播图&新书上架&热门书籍 -->
					<div class="row">
						<div class="col">
							<!-- 右9中第一行轮播图 -->
							<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">
						<!-- 右9中第二行新书上架 -->
						<div class="col" >
								<figure class="figure">
								  <img src="../Bootstrap02/img/3.png" class="figure-img img-fluid rounded" alt="...">
								  <figcaption class="figure-caption"><b>冷间谍</b><i class="bi bi-cart2 text-danger"></i></figcaption>
								</figure>
							</div>
							<div class="col" >
								<figure class="figure">
								  <img src="../Bootstrap02/img/3.png" class="figure-img img-fluid rounded" alt="...">
								  <figcaption class="figure-caption"><b>冷间谍</b><i class="bi bi-cart2 " style="color:greenyellow"></i></figcaption>
								</figure>
							</div>
							<div class="col" >
								<figure class="figure">
								  <img src="../Bootstrap02/img/3.png" class="figure-img img-fluid rounded" alt="...">
								  <figcaption class="figure-caption"><b>冷间谍</b>&nbsp;<i class="bi bi-cart2"></i>
								  </figcaption>
								</figure>
							</div>
							<div class="col" >
								<figure class="figure">
								  <img src="../Bootstrap02/img/3.png" class="figure-img img-fluid rounded" alt="...">
								  <figcaption class="figure-caption"><b>冷间谍</b><i class="bi bi-cart2 text-danger"></i></figcaption>
								</figure>
						 </div>
							<div class="col" >
								<figure class="figure">
								  <img src="../Bootstrap02/img/3.png" class="figure-img img-fluid rounded" alt="...">
								  <figcaption class="figure-caption"><b>冷间谍</b><i class="bi bi-cart2 text-danger"></i></figcaption>
								</figure>
							</div>
						</div>

					<div class="xxx">
						热门书籍
					</div>

					<div class="row">
						<!-- 右9中第三行热门书籍 -->
						<div class="col" >
								<figure class="figure">
								  <img src="../Bootstrap02/img/2.png" class="figure-img img-fluid rounded" alt="...">
								  <figcaption class="figure-caption"><b>第一商会</b><i class="bi bi-cart2 text-danger"></i></figcaption>
								</figure>
						</div>
							<div class="col" >
								<figure class="figure">
								  <img src="../Bootstrap02/img/5.png" class="figure-img img-fluid rounded" alt="...">
								  <figcaption class="figure-caption"><b>第一商会</b><i class="bi bi-cart2 text-danger"></i></figcaption>
								</figure>
							</div>
							<div class="col" >
								<figure class="figure">
								  <img src="../Bootstrap02/img/8.png" class="figure-img img-fluid rounded" alt="...">
								  <figcaption class="figure-caption"><b>第一商会</b><i class="bi bi-cart2 text-danger"></i></figcaption>
								</figure>
							</div>
							<div class="col" >
								<figure class="figure">
								  <img src="../Bootstrap02/img/6.png" class="figure-img img-fluid rounded" alt="...">
								  <figcaption class="figure-caption"><b>第一商会</b><i class="bi bi-cart2 text-danger"></i></figcaption>
								</figure>
						</div>
							<div class="col" >
								<figure class="figure">
								  <img src="../Bootstrap02/img/7.png" class="figure-img img-fluid rounded" alt="...">
								  <figcaption class="figure-caption"><b>第一商会</b></figcaption>
								</figure>
							</div>
					</div>
				</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>

五、熟悉其他的(页面内容-组件)等效果

这里的折叠、滚动监听、下拉菜单、分页、导航-面包屑导航、等这些都可以在

bootstrap中文文档里面有,接下来就是靠大家自己去发掘使用啦!

好啦!今天的知识分享也到这里啦!咱们有空再见哈!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值