栅格系统与布局

Use our powerful mobile-first flexbox grid to build layouts of all shapes and sizes thanks to a twelve column system, five default responsive tiers, Sass variables and mixins, and dozens of predefined classes.(摘自bootStrap官方文档)。

The BootStrap is so Great !now we will Learn the flexbox grid by using eclipse.

For example if we use 12 grid:

 <%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-ch">
<link rel="stylesheet" href="${pageContext.request.contextPath }/bootstrap3/css/bootstrap.min.css"/>
<link rel="stylesheet" href="${pageContext.request.contextPath }/bootstrap3/css/bootstrap.theme.min.css"/>
<script src="${pageContext.request.contextPath }/bootstrap3/js/jquery-1.11.2.min.js"></script>
<script src="${pageContext.request.contextPath }/bootstrap3/js/bootstrap.min.js"></script>
<title>Grid12</title>
<style type="text/css">
.c{ border: 1px solid gray //显示边框 宽度 1px 实体 灰色
}
</style>
</head>
<body>
<div class="container">
<div class="row">//十二列
<div class="col-md-1 c ">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c ">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c" >.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
</div>
</div>
</body>
</html>

others:

 <%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-ch">
<link rel="stylesheet" href="${pageContext.request.contextPath }/bootstrap3/css/bootstrap.min.css"/>
<link rel="stylesheet" href="${pageContext.request.contextPath }/bootstrap3/css/bootstrap.theme.min.css"/>
<script src="${pageContext.request.contextPath }/bootstrap3/js/jquery-1.11.2.min.js"></script>
<script src="${pageContext.request.contextPath }/bootstrap3/js/bootstrap.min.js"></script>
<title>Grid栅格12个格子</title>
<style type="text/css">
.c{
border: 1px solid gray
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-1 c ">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c ">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c" >.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
</div>
<div class="row">
<div class="col-md-8 c">.col-md-8</div>
<div class="col-md-4 c">.col-md-4</div>
</div>
<div class="row">
<div class="col-md-4 c">.col-md-4</div>
<div class="col-md-4 c">.col-md-4</div>
<div class="col-md-4 c">.col-md-4</div>
</div>
<div class="row">
<div class="col-md-6 c">.col-md-6</div>
<div class="col-md-6 c">.col-md-6</div>
</div>
</div>
</body>
</html>

The photo of result:

How it works ?

Bootstrap’s grid system uses a series of containers, rows, and columns to layout and align content. It’s built with flexbox and is fully responsive. Below is an example and an in-depth look at how the grid comes together.

Second

 <%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-ch">
<link rel="stylesheet" href="${pageContext.request.contextPath }/bootstrap3/css/bootstrap.min.css"/>
<link rel="stylesheet" href="${pageContext.request.contextPath }/bootstrap3/css/bootstrap.theme.min.css"/>
<script src="${pageContext.request.contextPath }/bootstrap3/js/jquery-1.11.2.min.js"></script>
<script src="${pageContext.request.contextPath }/bootstrap3/js/bootstrap.min.js"></script>
<title>Grid栅格12个格子</title>
<style type="text/css">
.c{
border: 1px solid gray
}
</style>
</head>
<body>
<p class="bg-primary">使用 .col-md-offset-* 类可以将列向右侧偏移。这些类实际是通过使用 * 选择器为当前元素增加了左侧的边距(margin)。例如,.col-md-offset-4 类将 .col-md-4 元素向右侧偏移了4个列(column)的宽度。</p>
<div class="container">
<div class="row c">
<div class="col-md-4 c">.col-md-4</div>
<div class="col-md-4 col-md-offset-4 c">.col-md-4 .col-md-offset-4</div>
</div>
<div class="row">
<div class="col-md-3 col-md-offset-3 c">.col-md-3 .col-md-offset-3</div>
<div class="col-md-3 col-md-offset-3 c">.col-md-3 .col-md-offset-3</div>
</div>
<div class="row">
<div class="col-md-6 col-md-offset-3 c">.col-md-6 .col-md-offset-3</div>
</div>
</div>
</body>
</html>

Third:

 <%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-ch">
<link rel="stylesheet" href="${pageContext.request.contextPath }/bootstrap3/css/bootstrap.min.css"/>
<link rel="stylesheet" href="${pageContext.request.contextPath }/bootstrap3/css/bootstrap.theme.min.css"/>
<script src="${pageContext.request.contextPath }/bootstrap3/js/jquery-1.11.2.min.js"></script>
<script src="${pageContext.request.contextPath }/bootstrap3/js/bootstrap.min.js"></script>
<title>列偏移</title>
<style type="text/css">
.c{
border: 1px solid gray
}
</style>
</head>
<body>
<p class="bg-primary"></p>
<div class="container">
<div class="row c">
<div class="col-md-8 ">
<div class="col-md-6 ">第二层6列</div>
<div class="col-md-6 c">第二层6列</div>
</div>
<div class="col-md-4 ">
第一层4列
</div>
</div>
</div>
</body>
</html>

fluid Layout!

 <%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-ch">
<link rel="stylesheet" href="${pageContext.request.contextPath }/bootstrap3/css/bootstrap.min.css"/>
<link rel="stylesheet" href="${pageContext.request.contextPath }/bootstrap3/css/bootstrap.theme.min.css"/>
<script src="${pageContext.request.contextPath }/bootstrap3/js/jquery-1.11.2.min.js"></script>
<script src="${pageContext.request.contextPath }/bootstrap3/js/bootstrap.min.js"></script>
<title>container</title>
<style type="text/css">
.c{
border: 1px solid yellow
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-1 c ">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c ">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c" >.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
</div>
</div>
<br/>
<div class="container-fluid ">
<div class="row">
<div class="col-md-1 c ">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c ">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c" >.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
<div class="col-md-1 c">.col-md-1</div>
</div>
</div>
</body>
</html>

Use .container-fluid for a full width container, spanning the entire width of the viewport.

BootStrap3栅格系统与布局的更多相关文章

  1. 深入理解BootStrap之栅格系统(布局)

    1.栅格系统(布局) Bootstrap内置了一套响应式.移动设备优先的流式栅格系统,随着屏幕设备或视口(viewport)尺寸的增加,系统会自动分为最多12列. 我在这里是把Bootstrap中的栅 ...

  2. [bootstrap] 栅格系统和布局

    1.简介 栅格系统(grid systems),也称为“网格系统”,运用固定的格子设计版面布局,风格工整简洁.是从平面栅格系统演变而来. Bootstrap建立在12列栅格系统.布局.组件之上.以规则 ...

  3. Bootstrap栅格系统(布局)

    栅格系统(布局) Bootstrap内置了一套响应式.移动设备优先的流式栅格系统,随着屏幕设备或视口(viewport)尺寸的增加,系统会自动分为最多12列. 我在这里是把Bootstrap中的栅格系 ...

  4. 巧用 BootStrap --- 栅格系统(布局)轻松搞定网页响应式布局!

    摘要:Bootstrap 为我们提供了一套响应式.移动设备优先的流式栅格系统,合理的使用栅格系统将会使得网站页面布局变得更加简单,在设置了媒体查询之后,响应式网站也无需再单独写了.接下来我以Boots ...

  5. Bootstrap3 栅格系统-简介

    Bootstrap 提供了一套响应式.移动设备优先的流式栅格系统,随着屏幕或视口(viewport)尺寸的增加,系统会自动分为最多12列.它包含了易于使用的预定义类,还有强大的mixin 用于生成更具 ...

  6. Bootstrap3 栅格系统-嵌套列

    为了使用内置的栅格系统将内容再次嵌套,可以通过添加一个新的 .row 元素和一系列 .col-sm-* 元素到已经存在的 .col-sm-* 元素内.被嵌套的行(row)所包含的列(column)的个 ...

  7. Bootstrap3 栅格系统-实例:从堆叠到水平排列

    使用单一的一组 .col-md-* 栅格类,就可以创建一个基本的栅格系统,在手机和平板设备上一开始是堆叠在一起的(超小屏幕到小屏幕这一范围),在桌面(中等)屏幕设备上变为水平排列.所有"列( ...

  8. Bootstrap3 栅格系统-栅格参数

    通过下表可以详细查看 Bootstrap 的栅格系统是如何在多种屏幕设备上工作的. -–下面有个"顶"字,你懂得O(∩_∩)O哈哈~ -–乐于分享,共同进步! -–更多文章请看:h ...

  9. Bootstrap3 栅格系统-媒体查询

    在栅格系统中,我们在 Less 文件中使用以下媒体查询(media query)来创建关键的分界点阈值. /* 超小屏幕(手机,小于 768px) */ /* 没有任何媒体查询相关的代码,因为这在 B ...

随机推荐

  1. 如何看Spring源码

    想要深入的熟悉了解Spring源码,我觉得第一步就是要有一个能跑起来的极尽简单的框架,下面我就教大家搭建一个最简单的Spring框架,而且是基于Java Config形式的零配置Spring框架. 首 ...

  2. 详解Android Activity启动模式

    相关的基本概念: 1.任务栈(Task)   若干个Activity的集合的栈表示一个Task.   栈不仅仅只包含自身程序的Activity,它也可以跨应用包含其他应用的Activity,这样有利于 ...

  3. R Programming week2 Functions and Scoping Rules

    A Diversion on Binding Values to Symbol When R tries to bind a value to a symbol,it searches through ...

  4. css定位position属性深究

    1.static:对象遵循常规流.此时4个定位偏移属性不会被应用. 2.relative:对象遵循常规流,并且参照自身在常规流中的位置通过top,right,bottom,left这4个定位偏移属性进 ...

  5. 使用Caliburn.Micro系列1:新建项目并引入CM

    一.WPF的几个MVVM模式实现 MVVMLight:小众的平民框架,实现简单粗暴.  pass:最近更新在15年 官网: http://www.mvvmlight.net/ 最近一篇内容全面的好文: ...

  6. 详解 pcap_findalldevs_ex

    pcap是packet capture的缩写.意为抓包. 功能:查找所有网络设备 原型:int pcap_findalldevs_ex(char* source,  struct pcap_rmtau ...

  7. caffe实现自己的层

    http://blog.csdn.net/xizero00/article/details/52529341 将这篇博客所讲进行了实现 1.LayerParameter也在caffe.proto文件中 ...

  8. java线程池 多线程搜索文件包含关键字所在的文件路径

    文件读取和操作类 import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; publi ...

  9. flutter 上传图片 image_picker 的使用

    Github地址: https://github.com/flutter/plugins/tree/master/packages/image_picker packages地址: https://p ...

  10. IIS+php服务器无法上传图片解决办法

    查找网上资料,发现php.ini下面有2个地方关于上传的配置: file_uploads = On  这里设置是否允许HTTP上传,默认应该为ON的 ;upload_tmp_dir=  这里设置上传文 ...