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
太原乔家大院天气9月21号天津天气情况四川省成都市10月天气宁夏中卫8月份天气怎么样天津9月20日到30日天气预报太原乔家大院天气石门6份天气情况四川省成都市10月天气崇信县历史天气情况明天渭南是什么天气延川今日天气预报四川省成都市10月天气惠州市10份天气预报延川今日天气预报天气对x波段雷达明天渭南是什么天气2017天气9月天津天气预报常德澧县一周天气预报15天查询天津9月20日到30日天气预报山西乔家大院天气预报一周天气西九华山天气预报一周天气预报常德澧县一周天气预报15天查询崇信县历史天气情况乔家大院风景区天气天津2017年11月3日天气乔家大院10天天气预报天津2017年11月3日天气乔家大院风景区天气山西乔家大院天气预报一周天气洛南石门天气预报23世纪已经来到,这世上流传这异世界的传说,我林萧,我的爷爷曾给我说过,他去过异世界。我原本以为这仅仅是个传说,可没想到有一天,国际联盟探险队和国际研究所找上我的爷爷,说异世界与我们断开了联系,此时,我才明白异世界是真的。我虽然不上朝,但并不代表我不办事 给我三十年,还你一个太平盛世我,叫做程敏刚,她,叫做杜淑萍,杜淑萍是我的老婆,大魏王朝,妖魔乱世,幽鬼横行。 当顾青玉睁开眼睛醒来之后却发现自己只有七日可活! 无奈之下,只好凭借驯养系统驯养一只青龟,将其化作自己的一个分身! 【叮!是否消耗成长点驯养青龟?】 【驯养成功!】 【青龟等级提升!】 …… 【叮!是否消耗进化点进化天元青龟?】 【进化成功!】 【天元青龟进化成为:天元龟!】 【叮!获得能力‘天元一气’!】 …… 顾青玉发现,自己驯养的分身不但可以不断升级,还可以不断的进化…… 少年张玄某一天偶获异能从此改变了他平凡的人生. 能够轻易撕裂敌人的利爪 一拳轰爆坦克的能量锤 自由翱翔在天空的滑翔 轻易摧毁飞机的鞭拳头 ...各种异能让他成就非凡! 让我们来看张玄如何收服众美女完美逆袭现在站在你面前的是—— 得文公司董事会、彩虹火箭队缔造者、逆属性大师、世界锦标赛冠军…… 传奇训练家陆野,回忆起首次直播时的场景,喟然长叹。 “说起来你们可能不信,我最初的愿望只是破十万订阅露个脸而已。” “我只想恰点钱,从一名游戏区UP主做起。” “我真没想当训练家啊!” 本书又名:《青春期训练家不会梦见神奥冠军》、《竹兰大小姐想让我告白》、《成为世界冠军从主播开始》…… 【融合世界观,平行世界+动画、游戏设定+特别篇什么是江湖?江湖便是人心,人心恶,江湖险。江湖风气云涌,邪恶势力盘根错节蓄势待发,墨家机关术再现江湖,是正是邪?活人炼僵尸,野兽军团汹涌来袭。八臂观音走下神坛,海底神功刀枪不如倭寇大军更要如何抵挡?一把来历不明的纯钧名剑,一处富可敌国的稀世宝藏,一场身不由己的家国恩怨。更有儿女情长,爱恨纠葛,他该如何面对? 英雄救美的谭天意外坠楼,醒来后发现自己竟然穿越到了平行世界? 更让他意外的是这个世界不仅时间线跟原时空对不上,而且世界背景也很不对... ... 不过还好在系统面前,一切魑魅魍魉都是渣渣! 本文描写一对乡下的老夫妻,一起过着平凡的而甜蜜的生活,苦中作乐,为了能够购买到一辆5000元的三轮车而,老两口不断去努力种地挣钱的故事。接近生活,代入感极强,本小说以一对现实生活中的夫妻那真正的故事作为取材,不脱离实际还有现实,生动的刻画了真实生活的那最为现实的写照,看完了之后,引人深思,令人更加的去珍惜现在所拥有的生活。趁您的亲人好友还在人世,多多珍惜,生活,那是最为苦涩而甜蜜着的。顾八方携带《武学加点系统》穿越异界,本以为是低武世界,谁知竟然遇到了邪灵妖魔。 面对武者完全无法对付的邪灵,顾八方丝毫不慌,他开启武学加点提升,无限变强之路。 四十年功力! 八十年功力! 一百二十年功力! 当顾八方横推一切,拳裂天地,脚踏苍穹之时,高高在上的至尊们才彻底惊醒。 大乾人皇:谁言邪灵不可灭,八方一出天地清! 浩然宗主:顾八方,天下第一奇才,我愿称他为武道最强。 岳麓院长:见过顾八方,我才知道什么叫勇、悍、莽! 邪灵宗主:我和顾八方,到底谁才是最大反派啊?
葬剑祈 朝仙道 白云历险记 末 日 皇天战尊 签到魔窟百年,我发现修仙是骗局 枕中一梦 妖怪驻守 让心儿静一静 梦囚天 元灵法则 海贼世界死过两次 隋逆 一路红尘一路情 原体:初现 从1997开始追凶 残阳起风雷 天源太虚 轮回世界:只有我知道剧情 蜡笔小新成长日记 9月21号天津天气预报 白洋淀天气查询 2017天气9月天津 天津9月20日到30日天气预报 9月21号天津天气情况 乔家大院30日天气预报 2017天气9月天津 沧州11月天气污染统计 乔家大院10天天气预报 惠州市10份天气预报 北京市东北部今晚天气 北京市东北部今晚天气 乔家大院天气天气预报一周 白洋淀天气查询 太原乔家大院天气 天津9月20日到30日天气预报 8月份宁夏中卫天气 9月21号天津天气预报 78月份的中卫天气如何 四川省成都市10月天气 白洋淀天气查询 四川省成都市10月天气 78月份的中卫天气如何 天气预报常德澧县一周天气预报15天查询 明天渭南是什么天气 乔家大院天气天气预报一周 9月21号天津天气预报 9月21号天津天气情况 78月份的中卫天气如何 乔家大院10天天气预报 天津9月20日到30日天气预报 山西北岳恒山天气预报 宁夏中卫8月份天气怎么样 太原乔家大院天气 乔家大院风景区天气 天津2017年11月3日天气 宁夏中卫8月份天气怎么样 2017天气9月天津 乔家大院风景区天气 天气对x波段雷达 天津2017年11月3日天气 沧州11月天气污染统计 乐东县历史天气 8月份宁夏中卫天气 延川今日天气预报 山西北岳恒山天气预报 北京市东北部今晚天气 天津2017年11月3日天气 乔家大院天气天气预报一周 石门天气网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 无限绝境 开始工业革命,才知道是仙武大秦 油灯记 神骨鬼牌 玄幻:毛头小子穿越三界 百度 百度 百度 百度 百度 太原乔家大院天气 山西乔家大院天气预报一周天气 惠州市10份天气预报 太原乔家大院天气 宁夏中卫8月份天气怎么样 沧州11月天气污染统计 宁夏中卫8月份天气怎么样 9月21号天津天气预报 天气预报常德澧县一周天气预报15天查询 9月21号天津天气预报 8月份宁夏中卫天气 乔家大院10天天气预报 山西北岳恒山天气预报 乔家大院风景区天气 山西北岳恒山天气预报 2017天气9月天津 明天渭南是什么天气 山西北岳恒山天气预报 9月21号天津天气情况 明天渭南是什么天气 洛南石门天气预报 西九华山天气预报一周 洛南石门天气预报 沧州11月天气污染统计 石门天气网 天气对x波段雷达 乔家大院天气天气预报一周 天津2017年11月3日天气 北京市东北部今晚天气 石门6份天气情况 亚星官网 亚星官网 万利官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网