栅格系统与布局

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. UWP Windows10开发获取设备位置(经纬度)

    1.首先要在UWP项目的Package.appxmanifest文件中配置位置权限,如下图所示: 2.Package.appxmanifest后选择第三个选项卡,勾选位置权限(Location) 打开 ...

  2. Flutter交互实战-即刻App探索页下拉&拖拽效果

    前言 Flutter最近比较热门,但是Flutter成体系的文章并不多,前期避免不了踩坑:我这篇文章主要介绍如何使用Flutter实现一个比较复杂的手势交互,顺便分享一下我在使用Flutter过程中遇 ...

  3. Spark学习之Spark调优与调试(7)

    Spark学习之Spark调优与调试(7) 1. 对Spark进行调优与调试通常需要修改Spark应用运行时配置的选项. 当创建一个SparkContext时就会创建一个SparkConf实例. 2. ...

  4. 洛谷 P1569 [USACO11FEB]属牛的抗议Generic Cow Prote…

    题目描述 Farmer John's N (1 <= N <= 100,000) cows are lined up in a row and numbered 1..N. The cow ...

  5. 类方法__setattr__,__delattr__,__getattr__

    __getattr__,_delattr_,_getattr_ class Foo: x = 1 def __init__(self, y): self.y = y def __getattr__(s ...

  6. 17Web服务器端控件

    Web服务器端控件 Web服务器端控件 ASP.Net提供了两类服务器端控件:Html服务器端控件和Web服务器端控件.由于Web服务器端控件功能更强大,和Windows应用程序的控件使用方法类似,容 ...

  7. 【VScode】使用VScode 来写markdown时序图

    准备工作 在VScode中下载插件Markdown Preview Enhanced插件 创建一个.md文件 在VScode中打开文件,界面内点击右键可以看到Open preview to the s ...

  8. Linux从入门到适应(一):VSCode C++环境配置

    作为在Windows环境下习惯使用Visual Studio IDE的人,对于Linux环境下的Vim编辑使用十分难受,虽然网上很多人说vim非常牛逼和强大,但是我更加习惯于使用VS code的界面, ...

  9. Dash Speed

    题目大意: 比特山是比特镇的飙车圣地.在比特山上一共有n 个广场,编号依次为1 到n,这些广场之间通过n - 1 条双向车道直接或间接地连接在一起,形成了一棵树的结构.因为每条车道的修建时间以及建筑材 ...

  10. Linux网络配置出现的问题

    网络连接 : 选择桥接模式进入字符界面后,管理员登入后  ifconfig显示eth0和ol,但是不显示静态IP地址,即无inet.地址.广播.掩码 解决方案: 1.使用sudo dhclient e ...