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
中国信用卡发展的现状中国建行信用卡积分兑换商城官网中国信用卡年费多少中国信用卡有什么用中国信用卡怎么冻结中国农业银行信用卡审核要多久中国银行车卡信用卡中国信用卡年费多少中国建设银行信用卡客户电话号码是多少钱中国兴业银行信用卡电话客服电话是多少中国兴业银行信用卡电话号码中国信用卡发展的现状中国银行app怎么查信用卡进度查询中国兴业银行信用卡电话中国信用卡年费多少中国兴业银行信用卡电话客服电话是多少中国银行emv信用卡年费中国信用卡怎么透支中国信用卡怎么透支中国农业银行信用卡申请进度查询官网中国建行信用卡积分兑换商城中国信用卡怎么透支中国建设银行信用卡客户电话号码是多少钱中国农业银行信用卡从哪里邮寄中国信用卡怎么冻结中国建设银行唯品会信用卡额度中国信用卡有什么用中国农业银行信用卡从哪里邮寄中国农业银行信用卡申请办理信用卡中国银行app怎么查信用卡进度查询在这汉末乱世之中,与其担惊受怕, 不如奋起争雄。 再多的描述都显得苍白无力,干他丫的。 吾所著之书,虽首本,亦会精彩绝伦。 别小看吾之水准,吾会用心书写。 望得 各位五湖四海兄弟姐妹的支持,吾希望汝等莫要不识好歹。穿越大武侠世界武当山,成为武当派第三代弟子首徒宋青书,并激活挨打就变强系统。 开局获得金钟罩大圆满! 黄衫女:你怎么也会九阴真经? 扫地僧:可恶!他金钟罩的境界怎会比老衲还高? 帝释天:老夫游戏人间千余年,竟然还比不上一个二十出头的小子…… 宋青书二十六岁,已站上武林之巅,被尊称一声无双剑仙!述说异世大陆,种族纷争,魔物横行,皇子身份,天资受阻,离乡背井,开启新的人生,主角冥皇:“世间没有逆天,我来创造逆天!” 亲爱的读者朋友,请静心阅读我的小说,用鲜花和收藏支持我吧!陈二狗前半辈子是个傻子,现实生活中的树先生,直到有一天,他得到了阴司的传承,成为了桃源村的土地神,掌一方土地造化。 从此,在他的地盘里,天材地宝,全都躲不过他的眼睛。养鱼建厂,盖房修路,他带着大伙一起发家致富。 只不过,他做事不太讲道理,渐渐的被人称为刁民。而从前被人人嫌弃的大傻子,也慢慢成为了众多美女,争相取悦讨好的香饽饽。一个出身贫寒的人 ,进入警局有多大的用处江辰穿越到玄幻世界,原本想要平凡过一生,可是却被太子陷害谋反,废掉修为,看守仙墓林。 好在他觉醒了模拟人生系统,可以在每一座仙墓旁选择奖励。 选择:丹田永生术。 选择:至尊骨。 选择:龙象镇狱劲。 …… 多年后,当他模拟完毕所有仙墓的人生,走出仙墓的时候,已经天下无敌。 这里讲的是一些怎样的故事呢? 人皮模特、人骨拼图、凶宅奇案、真人蜡像、密室杀人、碎尸惨案…… 这些故事背后是怎样的一群人呢? 囚禁者、恋物癖、人格分裂、流浪汉、乞丐、白领、高智商人群…… 当你站在地狱仰望天堂,才能真正听懂来自地狱深处的哀鸣。 世界上哪有什么天生的罪犯,只不过是把老实人逼急了而已。 本小说及人物纯属虚构,请勿对号入座。如有雷同,纯属巧合,切勿模仿。九天路上谁为尊,一遇神帝万法空。上古天域,诸神逆战,神帝陨落伴九天玄石重生,以逆天资质修无上法门,铸混沌金身,力破苍穹,为报挚爱背叛之仇,兄弟夺妻之恨,他逆转苍天,法度万古,诛魔神,斩天妖,血染修仙路。懒得写“十万块你还想结婚?根本就是想屁吃!”   “那些追我闺女的随便一个就比你好一万倍!”   “拿不出万彩礼,休想过我这一关!”   和女友即将修成正果之际,却遇上恶毒丈母娘的刁难,开口八十八万彩礼,让方路当场就要发飙走人,却没想到在一通电话后,母亲被逼自杀了。   竟是要用自己的命去换彩礼让方路结婚……
云山风云录 天道寻情 当个逍遥小皇帝 荒野暮年 人尊之界 雾弥之音 你好,穿越人 寡酒淡茶 万事屋故事会 只想打工的我被迫拯救世界 玄幻:九生轮回 太虚之荒古纪 寂灭深处 见不到的她 诸天从武林外传开始 狐妖小红娘: 签到生活 小老虎大冒险 阴阳怪术 别吓我!话疗吧 修仙轮回之万界穿梭 中国建设银行唯品会信用卡 中国兴业银行信用卡电话客服电话 中国银行emv信用卡年费 中国信用卡怎么透支 中国建设银行唯品会信用卡 中国建设银行信用卡查询进度 中国银行和移动信用卡 中国银行信用卡 中国建设银行唯品会信用卡额度 中国银行app怎么查信用卡进度查询 中国建设银行信用卡客户电话号码是多少钱 中国建设银行信用卡客户电话号码是多少 中国农业银行信用卡多久能办好 中国兴业银行信用卡电话客服电话是多少 中国农业银行信用卡审核要多久 中国信用卡怎么冻结 中国银行和移动信用卡 中国建设银行唯品会信用卡额度 中国建行信用卡积分兑换商城 中国信用卡发展的现状 中国兴业银行信用卡电话客服电话 中国信用卡年费多少 中国建行信用卡积分兑换商城官网 中国兴业银行信用卡电话 中国兴业银行信用卡电话客服电话是多少 中国农业银行信用卡多久能办好 中国建设银行唯品会信用卡额度 中国建行信用卡积分兑换商城官网 中国建行信用卡积分兑换商城 中国建设银行唯品会信用卡额度 中国信用卡怎么冻结 中国兴业银行信用卡电话客服电话 中国信用卡什么是金卡 中国信用卡发展的现状 中国农业银行信用卡从哪里邮寄 中国信用卡怎么冻结 中国信用卡什么是金卡 中国银行emv信用卡年费 中国农业银行信用卡多久能办好 中国信用卡年费多少 中国信用卡有什么用 中国银行app怎么查信用卡进度 中国农业银行信用卡申请进度查询官网 中国建设银行信用卡客户电话号码是多少 中国兴业银行信用卡电话 中国兴业银行信用卡电话客服电话 中国建设银行信用卡客户电话号码是多少 中国信用卡有什么用 中国农业银行信用卡申请办理信用卡 中国银行车卡信用卡 亚星游戏官网 亚星官网 亚星官网 亚星游戏官网 亚星官网 轻语花传奇 寻天珠 星月天帝 命横 剑破恒明 亚星官网 万利官网 欧博官网 亚星官网 AG真人 中国信用卡怎么透支 中国信用卡办理时长 中国兴业银行信用卡电话号码 中国信用卡怎么透支 中国建设银行信用卡客户电话号码是多少钱 中国兴业银行信用卡电话 中国兴业银行信用卡电话客服电话是多少 中国建设银行信用卡客户电话号码是多少 中国银行信用卡 中国农业银行信用卡审核要多久 中国银行app怎么查信用卡进度查询 中国农业银行信用卡审核要多久 中国建设银行唯品会信用卡额度 中国信用卡发展的现状 中国银行车卡信用卡 中国信用卡有什么用 中国银行emv信用卡年费 中国建设银行唯品会信用卡额度 中国建设银行信用卡客户电话号码是多少 中国银行emv信用卡年费 中国农业银行信用卡申请进度查询官网 中国银行和移动信用卡 中国建设银行信用卡逾期查询 中国农业银行信用卡申请办理信用卡 中国建行信用卡积分兑换商城 中国兴业银行信用卡电话客服电话是多少 中国建设银行唯品会信用卡 中国兴业银行信用卡电话客服电话是多少 中国信用卡有什么用 中国银行信用卡