本文翻译自【http://getbootstrap.com/2.3.2/scaffolding.html#gridSystem】

1、需要在H5的文档声明中使用;

2、如下一个简单的两列布局,先添加一个class=row,用class=span*来表示占几列。每一行的span加起来刚好是12;

<div class="row">
<div class="span4">...</div>
<div class="span8">...</div>
</div>

3、用.offset*表示右移多少。.offset4 moves .span4 over four columns.

4、嵌套列。新开辟一个row,在这个下面再添加span,但所有span之和为row的大小。e.g.

<div class="row">
<div class="span9">
Level 1 column
<div class="row">
<div class="span6">Level 2</div>
<div class="span3">Level 2</div>
</div>
</div>
</div>

5、流式网格布局,采用的是百分比而不是像素大小。

基本流体,只需将.row 改为 .row-fluid.

<div class="row-fluid">
<div class="span4">...</div>
<div class="span8">...</div>
</div>

流体偏移,仍旧使用.offset*

<div class="row-fluid">
<div class="span4">...</div>
<div class="span4 offset2">...</div>
</div>

流体嵌套

<div class="row-fluid">
<div class="span12">
Fluid 12
<div class="row-fluid">
<div class="span6">
Fluid 6
<div class="row-fluid">
<div class="span6">Fluid 6</div>
<div class="span6">Fluid 6</div>
</div>
</div>
<div class="span6">Fluid 6</div>
</div>
</div>
</div>

2、布局

1、固定布局,只需<div class="container">

<body>
<div class="container">
...
</div>
</body>

2、流体布局  <div class="container-fluid">

<div class="container-fluid">
<div class="row-fluid">
<div class="span2">
<!--Sidebar content-->
</div>
<div class="span10">
<!--Body content-->
</div>
</div>
</div>

3、响应式设计

要想使用响应式布局,需要添加相应的meta标签;同时还要添加bootstrap的响应式css。

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">

支持设备

Bootstrap supports a handful of media queries in a single file to help make your projects more appropriate on different devices and screen resolutions. Here's what's included:

Label Layout width Column width Gutter width
Large display 1200px and up 70px 30px
Default 980px and up 60px 20px
Portrait tablets 768px and above 42px 20px
Phones to tablets 767px and below Fluid columns, no fixed widths
Phones 480px and below Fluid columns, no fixed widths
/* Large desktop */
@media (min-width: 1200px) { ... } /* Portrait tablet to landscape and desktop */
@media (min-width: 768px) and (max-width: 979px) { ... } /* Landscape phone to portrait tablet */
@media (max-width: 767px) { ... } /* Landscape phones and down */
@media (max-width: 480px) { ... }

响应实用类

Responsive utility classes

可以用这些实用类在设备中显示或隐藏内容,下表是一个可用的类和他们在给定的设备中的效果,这些都可以在responsive.less中找到。

For faster mobile-friendly development, use these utility classes for showing and hiding content by device. Below is a table of the available classes and their effect on a given media query layout (labeled by device). They can be found in responsive.less.

Class Phones767px and below Tablets979px to 768px DesktopsDefault
.visible-phone Visible Hidden Hidden
.visible-tablet Hidden Visible Hidden
.visible-desktop Hidden Hidden Visible
.hidden-phone Hidden Visible Visible
.hidden-tablet Visible Hidden Visible
.hidden-desktop Visible Visible Hidden

When to use

Use on a limited basis and avoid creating entirely different versions of the same site. Instead, use them to complement each device's presentation. Responsive utilities should not be used with tables, and as such are not supported.

你可以用他们在不同的设备中呈现不同的显示。响应实用类不可以与表格一起用,因为它不支持表格。

e.g.

bootstrap使用笔记的更多相关文章

  1. Bootstrap~学习笔记索引

    回到占占推荐博客索引 bootstrap已经用了有段时间了,感觉在使用上还是比较容易接受的,在开发人员用起来上,也还好,不用考虑它的兼容性,手机,平台,PC都可以有效的兼容. bootstrap官方a ...

  2. 6.bootstrap练习笔记-缩略图和list-group

    bootstrap练习笔记-缩略图 1.其实缩略图很简单,只要按照固定的格式来设计 div.container 总容器  在宽度为1200px以上 div.row 一行内容 div.col-lg-3. ...

  3. 5.bootstrap练习笔记-巨幕和流体布局

    bootstrap练习笔记-巨幕和流体布局 1.在bootstrap中 .jumbotron可以设置巨幕效果 2.div.jumnotron自动设置一个黑色的巨幕效果 3.div.container ...

  4. 3.bootstrap练习笔记-媒体内容

    bootstrap练习笔记-多媒体对象 1.在bootstrap中,如果想存放内容,一种解决的方式就是利用media这个class 首先要设置一个div.container作为一个总的容器来存放内容 ...

  5. 4.bootstrap练习笔记-内容区块

    bootstrap练习笔记-内容区块 1.bootstrap中,采用的全部是div布局,把你的内容首先要包含在一个大的DIV区块当中 2.然后再写一个div.container,这个div里面存放真正 ...

  6. 1.bootstrap练习笔记-导航条

    bootstrap练习笔记 1.关于导航栏   官网链接:http://v3.bootcss.com/components/#nav 结构大概是这样的: nav标签标识导航栏 class为navbar ...

  7. 2.bootstrap练习笔记-轮播图

    bootstrap练习笔记-轮播图 1.要使用轮播图,首先要将其放在一个主div里面 设置id为myCaroysel class为carousel slide 设置id是标识这个div是轮播图,等到l ...

  8. Bootstrap学习笔记(二) 表单

    在Bootstrap学习笔记(一) 排版的基础上继续学习Bootstrap的表单,编辑器及head内代码不变. 3-1 基础表单 单中常见的元素主要包括:文本输入框.下拉选择框.单选按钮.复选按钮.文 ...

  9. bootstrap学习笔记之为导航条添加标题、二级菜单及状态 http://www.imooc.com/code/3120

    为导航条添加标题.二级菜单及状态 加入导航条标题 在Web页面制作中,常常在菜单前面都会有一个标题(文字字号比其它文字稍大一些),其实在Bootstrap框架也为大家做了这方面考虑,其通过" ...

  10. bootstrap学习笔记之基础导航条 http://www.imooc.com/code/3111

    基础导航条 在Bootstrap框中,导航条和导航从外观上差别不是太多,但在实际使用中导航条要比导航复杂得多.我们先来看导航条中最基础的一个--基础导航条. 使用方法: 在制作一个基础导航条时,主要分 ...

随机推荐

  1. 分析mybatis中 #{} 和${}的区别

    分析方法: 在 GenericTokenParser这个类的parse方法的这一行下个断点调试一下就明白了 builder.append(handler.handleToken(content)); ...

  2. mysql 无法连接提示 Authentication plugin 'caching_sha2_password' cannot be loaded

    mysql 无法连接提示 Authentication plugin 'caching_sha2_password' cannot be loaded 可能是密码没有设置或者,密码设置类型不符,可参考 ...

  3. The Preliminary Contest for ICPC Asia Shenyang 2019 F. Honk's pool

    题目链接:https://nanti.jisuanke.com/t/41406 思路:如果k的天数足够大,那么所有水池一定会趋于两种情况: ① 所有水池都是一样的水位,即平均水位 ② 最高水位的水池和 ...

  4. PacMan 03——追踪玩家

    版权申明: 本文原创首发于以下网站: 博客园『优梦创客』的空间:https://www.cnblogs.com/raymondking123 优梦创客的官方博客:https://91make.top ...

  5. 1. Ubuntu下使用pip方式安装tensorflow

    参考文档: https://tensorflow.google.cn/install/pip 首先明确,我们采用python3环境. 1. 先确认本机已安装好python3的环境 python3 -- ...

  6. LaTeX公式手册(全网最全)

    参考维基百科的数学公式教程 参考Cmd Markdown 公式指导手册 本文为 MathJax 在 Markdown 环境下的语法指引. 如何插入公式 \(\LaTeX\) 的数学公式有两种:行中公式 ...

  7. Python3 if 变量variable SQL where 语句拼接

    最近在写python3的项目,在实际中运用到了根据 if 判断变量variable ,然后去拼接where子句.但是在百度.BING搜索中未找到合适的答案,这是自己想出来的典型php写法,这里做一下记 ...

  8. Tomcat8 访问 manager App 失败

    Tomcat8 访问 manager App 失败 进入 tomcat 8 的下面路径 修改 上面 的 context.xml 注释了下面的框框 保存退出.重启tomcat

  9. Scrapy笔记12- 抓取动态网站

    Scrapy笔记12- 抓取动态网站 前面我们介绍的都是去抓取静态的网站页面,也就是说我们打开某个链接,它的内容全部呈现出来. 但是如今的互联网大部分的web页面都是动态的,经常逛的网站例如京东.淘宝 ...

  10. Android 开发基础入门篇: 复制一个工程作为一个新的工程

    说明 咱们做项目很多时候都需要复制一份工程出来作为一个新的工程 把第一节的工程拷贝到这一节 修改工程名字 打开软件导入此工程 修改包名 第一节的时候说了,一个APP一个包名 自行添加修改 自行修改 自 ...