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
威海 菏泽 汽车湖南长途汽车叶县汽车站在哪里广州至化州汽车宁波北仑到常熟的汽车站时刻表威海 菏泽 汽车郓城到聊城汽车多久叶县汽车站在哪里东胜到呼和浩特市汽车多长时间长安汽车车站时刻表白佛到河间汽车站叶县汽车站在哪里漯河汽车西站的电话是多少时间白佛到河间汽车站中阳汽车站附近小姐长安汽车车站时刻表昭觉寺汽车站最早几点上海长途汽车车票多少钱一张宁波北仑到常熟的汽车站时刻表做汽车儿童怎样买半票呼市到百灵庙汽车票价上海长途汽车车票多少钱一张东胜到呼和浩特市汽车多长时间淄博到泰兴汽车途径宜春汽车总站位置石家庄到佳木斯的汽车站时刻表宜春汽车总站位置靖县到怀化的汽车多久做汽车儿童怎样买半票泸州直达丹棱的汽车站时刻表简介无力,还是看正文吧 邓晨一次意外碰见了星外文明的基地,在生死间获得两件神器,并获得看衍生出的系统。 被盯上了的蓝星,神秘的蜘蛛图案和科技之门,究竟还有什么在窥视着蓝星呢 卍生界是贯穿所有界面的一个特俗界面,掌控所有界面的六道轮回,万羽飞原本是某个界面的轮回神君,因某种原因被其它神君共同追杀,在无力自保的情况下,最后选择自己进入轮回。这里肯定有人会问,既然当初打不过,难道重新修炼就能打得过?呵呵,卍生界就是关键。原先万羽飞只是某个界面的轮回神君,他所能掌控的只限于那个界面的天地规则,而卍生界确实贯穿所有界面的一个特俗存在,所掌控的是所有界面的生死与轮回……在这个钱财纵横的时代,没有钱你什么也不是,但是我史上最强富二代…… 美女成群,家族底厚。你跟我比!呵呵……晚自习我们班突然收到一封来信,它要和我们玩游戏,并且给每个人都发了红包,看着微信里多出的余额,我们毫不犹豫地在信上按了手印,接下来,怪事接连不断地出现在我们班,迎接我们的只有绝望。我们好像置身棋盘中。这盘棋意义何在?又将何时结束?身为棋子的我们又能做些什么……故事发生在西南某省城,以三个不同背景家庭的年轻人的主线,记述了他们为了自己和家庭而奋斗的故事。平淡的人生,其实就是最真实的生活。这三个家庭因为各种偶然的原因相识相知,一起经历了几十年的风雨岁月。本书记述了他们平凡而又多彩的人生,以此纪念逝去的岁月和见证过这一切的人们。。青年数学家叶小凡转生修仙世界,苦学功法,一心长生,科学修仙…… 九州大陆,万国争霸! 穿越大秦,成为公子赢昊! 开局发配凉州,遭遇匈奴劫杀,觉醒无双大帝系统! 签到千人战场,获得七星战将华雄效忠! 签到万人战场,获得八星上将赵云效忠! 签到十万战场,获得九星大将吕布效忠! 签到百万战场,获得十星神将项羽效忠! …… 且看公子赢昊,如何征战天下,成就无双大帝! 说我是九天云外望穿了虚空的盖世神帝也好?还是大陆之巅漂泊半生的逍遥魔头也罢,但只有我知道,我始终是凡尘市井中的那个锦衣玉食的纨绔少年,我也愿意当!你听说过多重人格么?你体会过么?别急,静下心来,让我们一起走进这隐秘的世界。嘘~,小心,别被“它”发现了。灵界中突然出现了不寻常的危机,这让灵界第一人林钧不知如何解决,而灵界之外,无数强者纷纷越界,想踏平灵界。 林钧苦守无果,最终无奈之下,他做出大胆决定,剥离人性,只身前往灵界之外,寻找问题根源,而分离出的人性,将会修炼灵界之中最强神法,重回大陆之巅,寻找救世之法。
极品回春大国医 触不可及的玫瑰 江湖,如梦楼 黄梁元年 我的天哪! 洪荒:我,后羿绝不射日 茅山天师玄宁子 藏剑:通天修为 风流毒公子 影埋 鬼怪游戏 重生之奋斗进行曲 重生之龙吟凤鸣 穿越成为林府三公子 暗夜卡徒 三冠王:开局和C罗搭档 全球惊悚:我再不死,就真无敌了 剑冲九霄之绝对领域 转生龙与精灵乱舞! 赶上穿书赘婿热潮后 徐州到贵州汽车票多少钱 烟台站汽车站 昭觉寺汽车站最早几点 宁波北仑到常熟的汽车站时刻表 湖南长途汽车 靖县到怀化的汽车多久 昭觉寺汽车站最早几点 带小孩坐汽车还是火车票 石家庄到佳木斯的汽车站时刻表 漯河汽车西站的电话是多少时间 长安汽车站能到深圳吗 长安汽车站能到深圳吗 广州去温州的汽车有么 烟台站汽车站 威海 菏泽 汽车 宁波北仑到常熟的汽车站时刻表 从汽车运输的发展历程 徐州到贵州汽车票多少钱 济宁到泰安的汽车线路查询 叶县汽车站在哪里 烟台站汽车站 叶县汽车站在哪里 济宁到泰安的汽车线路查询 上海长途汽车车票多少钱一张 长安汽车车站时刻表 广州去温州的汽车有么 徐州到贵州汽车票多少钱 济宁到泰安的汽车线路查询 济宁到泰安的汽车线路查询 石家庄到佳木斯的汽车站时刻表 宁波北仑到常熟的汽车站时刻表 常熟北站到上海青浦汽车站时刻表 广州至化州汽车 威海 菏泽 汽车 淄博到泰兴汽车途径 宜春汽车总站位置 广州至化州汽车 昭觉寺汽车站最早几点 淄博到泰兴汽车途径 中阳汽车站附近小姐 宜春汽车总站位置 带小孩坐汽车还是火车票 做汽车儿童怎样买半票 从汽车运输的发展历程 白佛到河间汽车站 常熟北站到上海青浦汽车站时刻表 长安汽车站能到深圳吗 宜春汽车总站位置 广州去温州的汽车有么 白音察干到呼和浩特的汽车 亚星官网 亚星游戏官网 亚星官网 亚星游戏官网 亚星官网 中州造神记 雾弥之音 第一纨绔:我爹陪我穿古代 擎天霸体诀 小友,你要修仙么? 亚星管理平台 澳门葡京官网 葡京官网 亚星管理平台 澳门葡京官网 做汽车儿童怎样买半票 广州去温州的汽车有么 东胜到呼和浩特市汽车多长时间 常熟北站到上海青浦汽车站时刻表 漯河汽车西站的电话是多少时间 呼市到百灵庙汽车票价 湖南长途汽车 呼市到百灵庙汽车票价 广州至化州汽车 济宁到泰安的汽车线路查询 石家庄到佳木斯的汽车站时刻表 中阳汽车站附近小姐 从汽车运输的发展历程 郓城到聊城汽车多久 广州去温州的汽车有么 上海长途汽车车票多少钱一张 常熟北站到上海青浦汽车站时刻表 白佛到河间汽车站 都安北汽车站开工了没 长安汽车站能到深圳吗 湖南长途汽车 常熟北站到上海青浦汽车站时刻表 中阳汽车站附近小姐 威海 菏泽 汽车 泸州直达丹棱的汽车站时刻表 叶县汽车站在哪里 呼市到百灵庙汽车票价 做汽车儿童怎样买半票 济宁到泰安的汽车线路查询 长安汽车车站时刻表