这是一段典型的html typical HTML file:

<!DOCTYPE html>
<html>
<head>
<title>Bootstrap 101 Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1>Hello, world!</h1>
<script src="http://code.jquery.com/jquery.js"></script>
</body>
</html>

To make this a Bootstrapped template, just include the appropriate CSS and JS files:

<!DOCTYPE html>
<html>
<head>
<title>Bootstrap 101 Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
</head>
<body>
<h1>Hello, world!</h1>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>

And you're set! With those two files added, you can begin to develop any site or application with Bootstrap.

全局设定global setting:

Requires HTML5 doctype

Bootstrap makes use of certain HTML elements and CSS properties that require the use of the HTML5 doctype. Include it at the beginning of all your projects.

Bootstrap用到的HTML元素和CSS属性需要HTML5 doctype。因此每个使用Bootstrap的页面都应该包启HTML5声明。

<!DOCTYPE html>
<html lang="en">
...
</html>

Typography and links

Bootstrap sets basic global display, typography, and link styles. Specifically, we:

  • Remove margin on the body
  • Set background-color: white; on the body
  • Use the @baseFontFamily@baseFontSize, and @baseLineHeight attributes as our typographic base
  • Set the global link color via @linkColor and apply link underlines only on :hover

These styles can be found within scaffolding.less.

Reset via Normalize

With Bootstrap 2, the old reset block has been dropped in favor of Normalize.css, a project by Nicolas Gallagher and Jonathan Neal that also powers the HTML5 Boilerplate. While we use much of Normalize within our reset.less, we have removed some elements specifically for Bootstrap.

Default grid system

Live grid example

The default Bootstrap grid system utilizes 12 columns, making for a 940px wide container without responsive features enabled. With the responsive CSS file added, the grid adapts to be 724px and 1170px wide depending on your viewport. Below 767px viewports, the columns become fluid and stack vertically.

做为框架默认的一部分,Bootstrap提供了940px宽, 12列的栅格系统(没有交互式开启)。如果引入了responsive css文件,那么就会依据你的设备viewport来更改宽度。如果设备在767以下,列就会变成流动

Basic grid HTML

For a simple two column layout, create a .row and add the appropriate number of .span* columns. As this is a 12-column grid, each.span* spans a number of those 12 columns, and should always add up to 12 for each row (or the number of columns in the parent).

因为他是一个12 column的网格,span数加起来总是要等于12或等于他的parent的宽度。

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

Given this example, we have .span4 and .span8, making for 12 total columns and a complete row.

(row内的所有span都位于同一行内

Offsetting columns

Move columns to the right using .offset* classes. Each class increases the left margin of a column by a whole column. For example,.offset4 moves .span4 over four columns.

移动列到右边使用offset类,美国类增加左边距。例如:offset4移动span4 4个列。

<div class="row">
<div class="span4">...</div>
<div class="span3 offset2">...</div>
</div>

Nesting columns

To nest your content with the default grid, add a new .row and set of .span* columns within an existing .span* column. Nested rows should include a set of columns that add up to the number of columns of its parent.

列的内嵌

在Bootstrap中使用静态(non-fluid)栅格很容易实现内嵌, 只要在一个已存在的 .span* 列中,嵌套一个新的 .row 列,然后在 .row 列中再添加一组 .span* 列即可。

<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>

猜一下怎么显示:

Live fluid grid example 流动网格系统

The fluid grid system uses percents instead of pixels for column widths. It has the same responsive capabilities as our fixed grid system, ensuring proper proportions for key screen resolutions and devices.

基于百分比,而非像素

流式栅格系统中的列宽使用百分比计算宽度而非像素。与像素栅格布局一样,Bootstrap根据设备和分辨率不同提供了不同的响应性方案。

Basic fluid grid HTML

Make any row "fluid" by changing .row to .row-fluid. The column classes stay the exact same, making it easy to flip between fixed and fluid grids.

把固定布局变成流式布局很简单,把 .row 变成 .row-fluid即可,列内容不变,因此在流式布局和固定布局之间转换非常简单。

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

Fluid offsetting

Operates the same way as the fixed grid system offsetting: add .offset* to any column to offset by that many columns.

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

Fluid nesting

Fluid grids utilize nesting differently: each nested level of columns should add up to 12 columns. This is because the fluid grid uses percentages, not pixels, for setting widths.

流式列的内嵌

流式列的内嵌稍稍有点不同:嵌套column level应该加起来为12,因为所有的内嵌列都是按比例分配父列的100%宽度。

<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>

怎么显示?

Fixed layout固定布局

Provides a common fixed-width (and optionally responsive) layout with only <div class="container"> required.

用 <div class="container"> 实现的简单的中央布局的页面,默认为940px宽。

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

Fluid layout

Create a fluid, two-column page with <div class="container-fluid">—great for applications and docs.

 <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>

Responsive design

Enabling responsive features

Turn on responsive CSS in your project by including the proper meta tag and additional stylesheet within the <head> of your document. If you've compiled Bootstrap from the Customize page, you need only include the meta tag.

  1. <metaname="viewport"content="width=device-width, initial-scale=1.0">
  2. <linkhref="assets/css/bootstrap-responsive.css"rel="stylesheet">

Heads up! Bootstrap doesn't include responsive features by default at this time as not everything needs to be responsive. Instead of encouraging developers to remove this feature, we figure it best to enable it as needed.

 
 

bootstrap scaffold框架的更多相关文章

  1. CI框架如何在主目录application目录之外使用uploadify上传插件和bootstrap前端框架:

    19:29 2016/3/10CI框架如何在主目录application目录之外使用uploadify上传插件和bootstrap前端框架:项目主路径:F:\wamp\www\graduationPr ...

  2. Bootflat – 基于 Bootstrap CSS 框架的扁平化界面

    Bootflat 是一个开源的扁平化的 UI 工具包,基于 Bootstrap 3.1.0 CSS 框架.它为 Web 开发人员提供了一个创建优雅的 Web 应用程序的更快,更容易和更少的重复任务的途 ...

  3. 基于springboot+bootstrap+mysql+redis搭建一套完整的权限架构【六】【引入bootstrap前端框架】

    https://blog.csdn.net/linzhefeng89/article/details/78752658 基于springboot+bootstrap+mysql+redis搭建一套完整 ...

  4. [转]50个极好的bootstrap 后台框架主题下载

    50个极好的bootstrap 后台框架主题下载 http://sudasuta.com/bootstrap-admin-templates.html 越来越多的设计师和前端工程师开始用bootstr ...

  5. 50个极好的bootstrap 后台框架主题下载

    50个极好的bootstrap 后台框架主题下载 http://sudasuta.com/bootstrap-admin-templates.html 越来越多的设计师和前端工程师开始用bootstr ...

  6. bootCDN引用的bootstrap前端框架套件和示例

    这是bootCDN上引用的bootstrap前端框架套件,由多个框架组合而成,方便平时学习和测试使用.生产环境要仔细琢磨一下,不要用开发版,而要用生产版.bootCDN的地址是:https://www ...

  7. BootStrap前端框架

    BootStrap前端框架 Bootstrap 教程:http://www.runoob.com/bootstrap/bootstrap-tutorial.html BpptStrap操作手册:htt ...

  8. bootstrap前端框架使用总结分享

    1.bootstrap 排版 全局样式style.css: 1.移除body的margin声明 2.设置body的背景色为白色 3.为排版设置了基本的字体.字号和行高 4.设置全局链接颜色,且当链接处 ...

  9. Bootstrap前端框架快速入门专题

    1.Bootstrap简介 Bootstrap,出自自 Twitter,是目前最受欢迎的前端框架. Bootstrap 是基于 HTML.CSS.JAVASCRIPT 的前端框架,它简洁灵活,使得 W ...

随机推荐

  1. Tomcat 中会话超时的相关配置

      QC同事提到似乎有时Tomcat的会话超时表现有问题,记录一下可能用到的配置. 1)超时时间的设定       tomcat的会话超时可以在多个级别上设置:tomcat实例级别.Web应用级别.s ...

  2. Protel99Se使用方法详解

    Protel99SE是应用于Windows9X/2000/NT操作系统下的EDA设计软件,采用设计库管理模式,可以进行联网设计,具有很强的数据交换能力和开放性及3D模拟功能,是一个32位的设计软件,可 ...

  3. Jedis中的一致性hash

    Jedis中的一致性hash 本文仅供大家参考,不保证正确性,有问题请及时指出 一致性hash就不多说了,网上有很多说的很好的文章,这里说说Jedis中的Shard是如何使用一致性hash的,也为大家 ...

  4. String、StringBuffer、StringBuilder之间区别

    String,StringBuffer,StringBuilder 之间区别 在字符串处理中C#提供了String.StringBuffer.StringBuilder三个类.那么他们到底有什么优缺点 ...

  5. Ext JS学习第十三天 Ext基础之 Ext.Element

    •Ext.Element提供了181个方法,嗯,还没完,只是在4.1版本中是这样,最新的4.2版本貌似又增加了新方法,可谓是相当丰富给力.那么根据操作类型基本可以分为查询系.DOM操作系.样式操作系. ...

  6. Android中图片处理相关问题

    在Android的开发中,我们经常回去处理一些图片相关的问题,比如当加载图片到内存中产生的OOM(OutOfMemory)异常.图片加载到内存中占多大内存的问题.jpg png两种常见的图片的原理及区 ...

  7. vs调试MEX文件

    http://www.cnblogs.com/lukylu/p/4042306.html matlab里面无法单步调试mex函数,故需转到VS上面调试,这里采用VS2010. 参考网上很多人写的方法但 ...

  8. BZOJ 1194: [HNOI2006]潘多拉的盒子( BFS + tarjan + dp )

    O(S²)枚举2个诅咒机, 然后O(n²)BFS去判断. 构成一个有向图, tarjan缩点, 然后就是求DAG的最长路.. ------------------------------------- ...

  9. 关于MyEclipse启动时的插件启动(Maven4MyEclipse)

    在myEclipse的应用中有许多插件在开发的时候都用不到,那么,这些插件在启动myEclipse的时候一起启动的越少越好了 Maven4Myeclipse update 每当启动myEclipse的 ...

  10. python2.5_1.5_通过指定的端口和协议找到服务名

    代码如下: # -*- coding: utf-8 -*- import socket def find_service_name(): protocolname = 'tcp' for port i ...