我们知道,在使用Bootstrap栅格的时候,我们可以对网页方便的进行模块分割。Bootstrap 包含了一个响应式的、移动设备优先的、不固定的网格系统,可以随着设备或视口大小的增加而适当地扩展到 12 列。
它包含了用于简单的布局选项的预定义类,也包含了用于生成更多语义布局的功能强大的混合类。如果要2等分,使用col-md-6即可;要3等分,使用col-md-4即可;但如果我们要5等分或者8等分怎么办呢?下面的示例是bootstrap五等分布局:
图片.png
Bootstrap 网格系统教程:可以学习和参考一下
http://www.runoob.com/bootstrap/bootstrap-grid-system.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!--视口的设置,让网页能等比例的缩放到对应设备中-->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!--告诉ie浏览器用最新内核去渲染网页-->
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<style type="text/css">
.col-xs-1-5,
.col-sm-1-5,
.col-md-1-5,
.col-lg-1-5 {
position: relative;
min-height: 1px;
padding-right: 10px;
padding-left: 10px;
}
.col-xs-1-5 {
width: 20%;
float: left;
}
@media (min-width: 768px) {
.col-sm-1-5 {
width: 20%;
float: left;
}
}
@media (min-width: 992px) {
.col-md-1-5 {
width: 20%;
float: left;
}
}
@media (min-width: 1200px) {
.col-lg-1-5 {
width: 20%;
float: left;
}
}
</style>
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<body>
<div class="container">
<div class="row">
<div class="col-xs-1-5">
<div class="items text-center">
<img class="img-responsive" src="../img/my.jpg" />
<div class="row">
<div class="name" id="">姓名:<span>王婷</span></div>
</div>
<div class="row">
<div class="sex" id="">性别:<span>女</span></div>
</div>
<div class="row">
<div class="orgin" id="">部门:<span>宣传部</span></div>
</div>
</div>
</div>
<div class="col-xs-1-5">
<div class="items text-center">
<img class="img-responsive" src="../img/my.jpg" />
<div class="row">
<div class="name" id="">姓名:<span>王婷</span></div>
</div>
<div class="row">
<div class="sex" id="">性别:<span>女</span></div>
</div>
<div class="row">
<div class="orgin" id="">部门:<span>宣传部</span></div>
</div>
</div>
</div>
<div class="col-xs-1-5">
<div class="items text-center">
<img class="img-responsive" src="../img/my.jpg" />
<div class="row">
<div class="name" id="">姓名:<span>王婷</span></div>
</div>
<div class="row">
<div class="sex" id="">性别:<span>女</span></div>
</div>
<div class="row">
<div class="orgin" id="">部门:<span>宣传部</span></div>
</div>
</div>
</div>
<div class="col-xs-1-5">
<div class="items text-center">
<img class="img-responsive" src="../img/my.jpg" />
<div class="row">
<div class="name" id="">姓名:<span>王婷</span></div>
</div>
<div class="row">
<div class="sex" id="">性别:<span>女</span></div>
</div>
<div class="row">
<div class="orgin" id="">部门:<span>宣传部</span></div>
</div>
</div>
</div>
<div class="col-xs-1-5">
<div class="items text-center">
<img class="img-responsive" src="../img/my.jpg" />
<div class="row">
<div class="name" id="">姓名:<span>王婷</span></div>
</div>
<div class="row">
<div class="sex" id="">性别:<span>女</span></div>
</div>
<div class="row">
<div class="orgin" id="">部门:<span>宣传部</span></div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
原文作者:祈澈姑娘