bootstrap使用笔记
本文翻译自【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使用笔记的更多相关文章
- Bootstrap~学习笔记索引
回到占占推荐博客索引 bootstrap已经用了有段时间了,感觉在使用上还是比较容易接受的,在开发人员用起来上,也还好,不用考虑它的兼容性,手机,平台,PC都可以有效的兼容. bootstrap官方a ...
- 6.bootstrap练习笔记-缩略图和list-group
bootstrap练习笔记-缩略图 1.其实缩略图很简单,只要按照固定的格式来设计 div.container 总容器 在宽度为1200px以上 div.row 一行内容 div.col-lg-3. ...
- 5.bootstrap练习笔记-巨幕和流体布局
bootstrap练习笔记-巨幕和流体布局 1.在bootstrap中 .jumbotron可以设置巨幕效果 2.div.jumnotron自动设置一个黑色的巨幕效果 3.div.container ...
- 3.bootstrap练习笔记-媒体内容
bootstrap练习笔记-多媒体对象 1.在bootstrap中,如果想存放内容,一种解决的方式就是利用media这个class 首先要设置一个div.container作为一个总的容器来存放内容 ...
- 4.bootstrap练习笔记-内容区块
bootstrap练习笔记-内容区块 1.bootstrap中,采用的全部是div布局,把你的内容首先要包含在一个大的DIV区块当中 2.然后再写一个div.container,这个div里面存放真正 ...
- 1.bootstrap练习笔记-导航条
bootstrap练习笔记 1.关于导航栏 官网链接:http://v3.bootcss.com/components/#nav 结构大概是这样的: nav标签标识导航栏 class为navbar ...
- 2.bootstrap练习笔记-轮播图
bootstrap练习笔记-轮播图 1.要使用轮播图,首先要将其放在一个主div里面 设置id为myCaroysel class为carousel slide 设置id是标识这个div是轮播图,等到l ...
- Bootstrap学习笔记(二) 表单
在Bootstrap学习笔记(一) 排版的基础上继续学习Bootstrap的表单,编辑器及head内代码不变. 3-1 基础表单 单中常见的元素主要包括:文本输入框.下拉选择框.单选按钮.复选按钮.文 ...
- bootstrap学习笔记之为导航条添加标题、二级菜单及状态 http://www.imooc.com/code/3120
为导航条添加标题.二级菜单及状态 加入导航条标题 在Web页面制作中,常常在菜单前面都会有一个标题(文字字号比其它文字稍大一些),其实在Bootstrap框架也为大家做了这方面考虑,其通过" ...
- bootstrap学习笔记之基础导航条 http://www.imooc.com/code/3111
基础导航条 在Bootstrap框中,导航条和导航从外观上差别不是太多,但在实际使用中导航条要比导航复杂得多.我们先来看导航条中最基础的一个--基础导航条. 使用方法: 在制作一个基础导航条时,主要分 ...
随机推荐
- JDK安装—JAVA
下载JDK 下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html 关于版本选择需要注意的问题: 如果eclip ...
- Linux从入门到放弃、零基础入门Linux(第四篇):在虚拟机vmware中安装centos7.7
如果是新手,建议安装带图形化界面的centos,这里以安装centos7.7的64位为例 一.下载系统镜像 镜像文件下载链接https://wiki.centos.org/Download 阿里云官网 ...
- CDH报错:ScmActive at bootup: Failed to validate the identity of Cloudera Manager.
报错原因以及解决办法在官网: https://www.cloudera.com/documentation/enterprise/5-8-x/topics/cm_failover_db.html 1. ...
- 10年前错过比特币,如今有斯坦福区块链项目pi币,对标btc,手机免费挖矿详细教程。
这一个斯坦福几个博士创业者做一个项目,目前还处于早期阶段,除了每天点一下挖矿之外,貌似不需要其他的操作,不需要耗费流量资源和手机大量的运算能力,就是一个安静的App而已....国内目前知道的人还不太多 ...
- centos自动同步服务器时间
原文:https://my.oschina.net/yysue/blog/1628733 1.安装ntpdate yum install ntpdate -y 2.测试是否正常 ntpdate cn. ...
- guava布隆过滤器
pom引入依赖 <dependency> <groupId>com.google.guava</groupId> <artifactId>guava&l ...
- php策略模式(strategy pattern)
... <?php /* The strategy pattern defines a family of algorithms, each of which is encapsulated a ...
- 03-C#笔记-数据类型
--- # 1 数据类型 --- ## 1 和C++不同的数据类型: byte: 8位,0~255 decimal:范围大于double,128位 sbyte: 8位,-128~127 uint 32 ...
- 小学四则运算口算练习app---No.7
今天主要改了设置页面的提示框以及按钮的闪退问题: activity_calculators .class import android.support.v7.app.AppCompatActivity ...
- three.js 离线API