1.只需要提供固定日丁ML结构,添加固定的class样式,就可以完成
指定效果的实现。
Bootstrap在jQuery的基础工作,可以理解Bootstrap就是jQuery的一个插件。
Bootstrap使得Web开发更加快捷,代码优雅,美观大方。
响应式布局:一个网站能够兼容多个终端(手机、iPad等),而不需要为每个终端做一个特定的版
本。此概念是为解决移动互联网浏览而诞生的。
2.模板
<head>
<meta charset="utf-8">
<!--声明文档兼容模式,表示使用IE浏览器的最新模式-->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--设置视图的宽度(值为设备的理想宽度),页面初始缩放值<理想宽度/可见宽度>-->
<!--视图的作用:在移动浏览器中,当页面宽度超出设备,浏览器内部虚拟的一个页面容器,会将页面缩放到设备这么大来展示-->
<!--width 设置layout viewport 的宽度,为一个正整数,或字符串"width-device"(表示采用设备的宽度)
initial-scale 设置页面的初始缩放值,为一个数字,可以带小数
minimum-scale 允许用户的最小缩放值,为一个数字,可以带小数
maximum-scale 允许用户的最大缩放值,为一个数字,可以带小数
height 设置layout viewport 的高度,这个属性不重要,很少使用
user-scalable 是否允许用户进行缩放,值为"no"或"yes", no 代表不允许,yes代表允许
如果设置"user-scalable=no",那么"minimum-scale"和"maximum-scale"无效
-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<title>Bootstrap基本模板</title>
<!-- 引入Bootstrap核心样式文件 -->
<link href="../../css/bootstrap.min.css" rel="stylesheet">
<!-- 引入jQuery核心js文件 -->
<script src="../../js/jquery-1.11.0.min.js"></script>
<!-- 引入BootStrap核心js文件 -->
<script src="../../js/bootstrap.min.js"></script>
</head>
3.Bootstrap提供了一套响应式、移动设备优先的流式栅格系统,随着屏幕或视图(viewport)尺
寸的增加,系统会自动分为最多12列。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--设置视口的宽度(值为设备的理想宽度),页面初始缩放值<理想宽度/可见宽度>-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<title>首页重写</title>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-4 col-md-4 col-xs-4">
![](img/logo2.png)
</div>
<div class="col-lg-5 col-md-5 col-xs-4 hidden-xs">
![](img/header.png)
</div>
<div class="col-lg-3 col-md-3 col-xs-12" style="padding-top: 10px;">
<a href="#">登录</a>
<a href="#">注册</a>
<a href="#">购物车</a>
</div>
</div>
</div>
<div class="container">
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">首页</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active">
<a href="#">手机数码 <span class="sr-only">(current)</span></a>
</li>
<li>
<a href="#">家用电器</a>
</li>
<li>
<a href="#">鞋靴箱包</a>
</li>
<li>
<a href="#">电脑办公</a>
</li>
<li>
<a href="#">孕婴保健</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">所有分类 <span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<a href="#">手机数码</a>
</li>
<li>
<a href="#">家用电器</a>
</li>
<li>
<a href="#">鞋靴箱包</a>
</li>
<li role="separator" class="divider"></li>
<li>
<a href="#">电脑办公a>
</li>
<li role="separator" class="divider"></li>
<li>
<a href="#">孕婴保健</a>
</li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-right">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
</div>
<div class="container">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
![](img/1.jpg)
<div class="carousel-caption">
...
</div>
</div>
<div class="item">
![](img/2.jpg)
<div class="carousel-caption">
...
</div>
</div>
<div class="item">
![](img/3.jpg)
<div class="carousel-caption">
...
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
<!--热门商品-->
<div class="container">
<div class="row">
<span style="font-size: 30px; padding-left: 15px;">
热门商品
![](img/title2.jpg)
</span>
</div>
<!--图片内容-->
<div class="row">
<div class="col-md-2" style="">
![](img/big01.jpg)
</div>
<!--右边图-->
<div class="col-md-10">
<div class="col-md-6" style=" height: 190px;">
![](img/middle01.jpg)
</div>
<div class="col-md-2" align="center">
![](img/small03.jpg)
<a href="#">
<p style="color: gray;">电炖锅</p>
</a>
<a href="#">
<p style="color: red;">¥499</p>
</a>
</div>
<div class="col-md-2" align="center">
![](img/small03.jpg)
<a href="#">
<p style="color: gray;">电炖锅</p>
</a>
<a href="#">
<p style="color: red;">¥499</p>
</a>
</div>
<div class="col-md-2" align="center">
![](img/small03.jpg)
<a href="#">
<p style="color: gray;">电炖锅</p>
</a>
<a href="#">
<p style="color: red;">¥499</p>
</a>
</div>
<div class="row">
<div class="col-md-2" align="center">
![](img/small03.jpg)
<a href="#">
<p style="color: gray;">电炖锅</p>
</a>
<a href="#">
<p style="color: red;">¥499</p>
</a>
</div>
<div class="col-md-2" align="center">
![](img/small03.jpg)
<a href="#">
<p style="color: gray;">电炖锅</p>
</a>
<a href="#">
<p style="color: red;">¥499</p>
</a>
</div>
<div class="col-md-2" align="center">
![](img/small03.jpg)
<a href="#">
<p style="color: gray;">电炖锅</p>
</a>
<a href="#">
<p style="color: red;">¥499</p>
</a>
</div>
<div class="col-md-2" align="center">
![](img/small03.jpg)
<a href="#">
<p style="color: gray;">电炖锅</p>
</a>
<a href="#">
<p style="color: red;">¥499</p>
</a>
</div>
<div class="col-md-2" align="center">
![](img/small03.jpg)
<a href="#">
<p style="color: gray;">电炖锅</p>
</a>
<a href="#">
<p style="color: red;">¥499</p>
</a>
</div>
<div class="col-md-2" align="center">
![](img/small03.jpg)
<a href="#">
<p style="color: gray;">电炖锅</p>
</a>
<a href="#">
<p style="color: red;">¥499</p>
</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
网友评论