1
1
1
1
1
1
1
1
1
1
1
1
4
4
4
4
8
6
6
12

The default grid system provided as part of Bootstrap is a 940px-wide, 12-column grid.

It also has four responsive variations for various devices and resolutions: phone, tablet portrait, table landscape and small desktops, and large widescreen desktops.

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

As shown here, a basic layout can be created with two "columns," each spanning a number of the 12 foundational columns we defined as part of our grid system.


Offsetting columns

4
4 offset 4
3 offset 3
3 offset 3
8 offset 4
<div class="row">
  <div class="span4">...</div>
  <div class="span4 offset4">...</div>
</div>

Nesting columns

With the static (non-fluid) grid system in Bootstrap, nesting is easy. To nest your content, just add a new .row and set of .span* columns within an existing .span* column.

Example

Nested rows should include a set of columns that add up to the number of columns of it's parent. For example, two nested .span3 columns should be placed within a .span6.

Level 1 of column
Level 2
Level 2
<div class="row">
  <div class="span12">
    Level 1 of column
    <div class="row">
      <div class="span6">Level 2</div>
      <div class="span6">Level 2</div>
    </div>
  </div>
</div>

Fluid columns

1
1
1
1
1
1
1
1
1
1
1
1
4
4
4
4
8
6
6
12

Percents, not pixels

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

Fluid rows

Make any row fluid simply by changing .row to .row-fluid. The columns stay the exact same, making it super straightforward to flip between fixed and fluid layouts.

Markup

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

Fluid nesting

Nesting with fluid grids is a bit different: the number of nested columns doesn't need to match the parent. Instead, your columns are reset at each level because each row takes up 100% of the parent column.

Fluid 12
Fluid 6
Fluid 6
<div class="row-fluid">
  <div class="span12">
    Level 1 of column
    <div class="row-fluid">
      <div class="span6">Level 2</div>
      <div class="span6">Level 2</div>
    </div>
  </div>
</div>
Variable Default value Description
@gridColumns 12 Number of columns
@gridColumnWidth 60px Width of each column
@gridGutterWidth 20px Negative space between columns
@siteWidth Computed sum of all columns and gutters Counts number of columns and gutters to set width of the .container-fixed() mixin

Variables in LESS

Built into Bootstrap are a handful of variables for customizing the default 940px grid system, documented above. All variables for the grid are stored in variables.less.

How to customize

Modifying the grid means changing the three @grid* variables and recompiling Bootstrap. Change the grid variables in variables.less and use one of the four ways documented to recompile. If you're adding more columns, be sure to add the CSS for those in grid.less.

Staying responsive

Customization of the grid only works at the default level, the 940px grid. To maintain the responsive aspects of Bootstrap, you'll also have to customize the grids in responsive.less.

Fixed layout

The default and simple 940px-wide, centered layout for just about any website or page provided by a single <div class="container">.

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

Fluid layout

<div class="container-fluid"> gives flexible page structure, min- and max-widths, and a left-hand sidebar. It's great for apps and docs.

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

Responsive devices

What they do

Media queries allow for custom CSS based on a number of conditions—ratios, widths, display type, etc—but usually focuses around min-width and max-width.

  • Modify the width of column in our grid
  • Stack elements instead of float wherever necessary
  • Resize headings and text to be more appropriate for devices

Use media queries responsibly and only as a start to your mobile audiences. For larger projects, do consider dedicated code bases and not layers of media queries.

Supported devices

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
Smartphones 480px and below Fluid columns, no fixed widths
Smartphones to tablets 767px and below Fluid columns, no fixed widths
Portrait tablets 768px and above 42px 20px
Default 980px and up 60px 20px
Large display 1200px and up 70px 30px

Requires meta tag

To ensure devices display responsive pages properly, include the viewport meta tag.

<meta name="viewport" content="width=device-width, initial-scale=1.0">

Using the media queries

Bootstrap doesn't automatically include these media queries, but understanding and adding them is very easy and requires minimal setup. You have a few options for including the responsive features of Bootstrap:

  1. Use the compiled responsive version, bootstrap-responsive.css
  2. Add @import "responsive.less" and recompile Bootstrap
  3. Modify and recompile responsive.less as a separate file

Why not just include it? Truth be told, not everything needs to be responsive. Instead of encouraging developers to remove this feature, we figure it best to enable it.

// Landscape phones and down
@media (max-width: 480px) { ... }
// Landscape phone to portrait tablet
@media (max-width: 768px) { ... }
// Portrait tablet to landscape and desktop
@media (min-width: 768px) and (max-width: 980px) { ... }
// Large desktop
@media (min-width: 1200px) { .. }

Responsive utility classes

What are they

For faster mobile-friendly development, use these basic utility classes for showing and hidding content by device.

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.

For example, you might show a <select> element for nav on mobile layouts, but not on tablets or desktops.

Support classes

Shown here is a table of the classes we support and their effect on a given media query layout (labeled by device). They can be found in responsive.less.

Class Phones 480px and below Tablets 767px and below Desktops 768px and above
.visible-phone Visible
.visible-tablet Visible
.visible-desktop Visible
.hidden-phone Visible Visible
.hidden-tablet Visible Visible
.hidden-desktop Visible Visible

Test case

Resize your browser or load on different devices to test the above clases.

Visible on...

  • Phone✔ Phone
  • Tablet✔ Tablet
  • Desktop✔ Desktop

Hidden on...

  • Phone✔ Phone
  • Tablet✔ Tablet
  • Desktop✔ Desktop
12号到15号天气预报2月加拿大的天气12号到15号天气预报英国湖区6月天气情况宜城1月份天气2013年武汉4月天气榆林未来一个月的天气12号到15号天气预报北京的三月底天气如何下个的天气预报西雅图的天气如何12号到15号天气预报榆林11月天气预报西雅图 11月天气10月15日温哥华天气预报下个的天气预报都匀市2017年10月份天气西雅图 11月份天气西雅图 11月份天气山东广铙未来15天天气阿图什的天气预报西雅图 11月份天气北京的三月底天气如何2016年漳州12月份天气宜城1月份天气2017年漳州龙文区天气英国湖区6月天气情况2016年漳州12月份天气山东广铙未来15天天气榆林11月天气预报阳城三名初中生秉承不同的恋爱观,走向了三种人生。穿越洪荒百万年,还是玄仙修为   林长青绝望之际,师尊通天赐予九转金丹   没想到,竟然觉醒诸天赠送系统!   赠送九转金丹,返还百亿功德!   赠送通天剑符,返还神象镇狱劲!   赠送黄中李,返还混沌灵根!   赠送盘古精血,返还……   林长青行走洪荒,赠送无数宝物,杀妖,屠魔,救人族!   终于,当量劫降临之时,林长青一人横立量劫之前,挥手扫灭无边劫云!一个名为往生界面的神秘存在将已“死去”的人们复活化作超界者于各个界面来回穿梭,执行各种任务。 往生界面——“签下签约,死亡或是活下去变得更强,由你自己决定。” 运气亦可能是实力的一部分....本书以主人公于乐的成长经历为主线,描述了以于乐为代表的85后在社会快速发展浪潮中经历的种种改变。涵盖了童年、校园和职场等阶段,有励志、有青春、有怀旧、有伤感、有纯真的爱情和你我共同经历过的回忆。一直遭受女朋友母亲无情刁难辱骂为“破代驾”的他,却因其英俊,技术好被绝美女客户看中,青睐有加! 旋即,叶飞豪在卷入一场女人的战争后,可谓时来运转,竟意外获得第一桶金,并寻得惊世灵根,激发旷世医武道法! 从此他投身商海,掀波弄潮,美女财富涌来;更是纵横医武,打脸各色权贵,横扫都市,成就一代豪横世家!剑走轻灵,取日月之息,潇洒江湖。然而,剑道漫漫,成功者寥寥无几。在世间剑修没落的时候,一位少年阴差阳错走上了习剑之路……在超一线城市当贫困户怎么办? 别慌,本系统带你装逼带你飞! 秦寿:系统,你不是人,但你是真的狗啊! 系统:嗯哼,你最近有点飘啊!信不信本大爷解绑? 秦寿:系统爸爸我错了! ………………………穿越到了一个全新的异世界, 在这个剑与魔法交织的世界里, 主角吕越点燃自己的斗气, 拳打异族,脚踢鬼神, 在血与火的试炼中, 吕越逐渐走向无敌2260年人类过度开采地球,生态环境严重破坏,不适宜人类生存 地球权贵移民火星 平民留在地球 创世神埔思在地球放下星际的产物——星穹之子 以拯救百姓于水火男子:兄台,我观你面色红润,许是患有大病啊 “大夫,您怎知晓,我这见到您身上那白花花的银两着实是心痒难耐啊。” “您不觉得这像极了我前些日头丢落的吗?” “兄台言之有理” 男子看着那脖间的刀,想了想命重要。
震惊:我的祖仙是大佬! 签到万年,身份被美女徒孙曝光了 乱世剧情 君临地球玩逆袭 剑寻兮 西游:人在地府,朝九晚五 等到春花烂漫时 冰山美女的最强兵王 阴棺借道 女友的游戏实力竟然超强 我们时刻成长 万世归来 他朝若是同淋雪 唯我超然 往来夕 造魔之路 我不想上梁山 从原始部落开始打造最强文明 末世游戏:我成了一只丧尸 第九国度 2017宜城历史天气 西雅图天气预报11月查询 都匀市2017年10月份天气 宜城1月份天气 2017宜城历史天气 2017年9月湖北宜城天气 都匀9月20日天气预报 下周日深圳的天气预报 2017年漳州龙文区天气 愉林的天气 北京的三月底天气如何 成都石家庄天气预报15天 三亚下个月的天气情况 西雅图天气预报11月查询 2013年武汉4月天气 宜城1月份天气 都匀9月20日天气预报 2017年漳州龙文区天气 7月23和24日漳州天气预报 12号到15号天气预报 西雅图天气预报11月查询 10月15日温哥华天气预报 2月加拿大的天气 西雅图 11月天气 下个的天气预报 三亚下个月的天气情况 2017年漳州龙文区天气 2月加拿大的天气 7月23和24日漳州天气预报 2017年漳州龙文区天气 宜城1月份天气 西雅图天气预报11月查询 瓮安近七天天气 2013年武汉4月天气 2016年漳州12月份天气 宜城1月份天气 瓮安近七天天气 都匀市2017年10月份天气 三亚下个月的天气情况 10月15日温哥华天气预报 英国湖区6月天气情况 愉林的天气 山东未来3天的天气预报 都匀9月20日天气预报 西雅图 11月天气 西雅图天气预报11月查询 成都石家庄天气预报15天 英国湖区6月天气情况 三亚下个月的天气情况 榆林未来一个月的天气 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 我与怪族之间的故事 天革 冰消解厄小记 食灵者 辞职去当玄术师 澳门葡京官网 快连下载 欧博官网 快连下载 亚星管理平台 愉林的天气 榆林未来一个月的天气 2017宜城历史天气 榆林未来一个月的天气 榆林11月天气预报 都匀9月20日天气预报 宜城1月份天气 西雅图 11月天气 西雅图 11月份天气 阿图什的天气预报 都匀9月20日天气预报 7月23和24日漳州天气预报 山东未来3天的天气预报 12号到15号天气预报 7月23和24日漳州天气预报 愉林的天气 2013年武汉4月天气 瓮安近七天天气 瓮安近七天天气 2016年漳州12月份天气 2017宜城历史天气 西雅图 11月份天气 榆林未来一个月的天气 都匀9月20日天气预报 都匀市2017年10月份天气 西雅图的天气如何 三亚下个月的天气情况 12号到15号天气预报 西雅图天气预报11月查询 下周日深圳的天气预报