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
巫溪摩托车驾校多少钱渭南驾校学费巫溪宁安驾校报名费潍坊市青州盛华驾校韦斗路鹏翔驾校巫溪摩托车驾校多少钱太原丰峰驾校的老板巫溪宁安驾校报名费天津北仓驾校电话同安驾校那里包过拿证通渭那个驾校能考试巫溪宁安驾校报名费太原安盛驾校如何通渭哪个驾校好巫溪有哪些摩托车驾校同安驾校那里包过拿证太原丰峰驾校校长通泰驾校小车教练通泰驾校小车教练巫溪驾校多少钱天津北仓驾校科1时间通泰驾校小车教练天津北仓驾校电话汶上强盛驾校怎么样?韦斗路鹏翔驾校汶上强盛驾校电话旺通驾校地址汶上强盛驾校怎么样?巫溪驾校多少钱太原安盛驾校如何 自虚幻世界无情地断裂成上界与下界后,文明间难以逾越的鸿沟便诞生了。年轻人,倘若你面前是充盈着未知气味的深渊,请不要害怕,提着灯大胆往前迈出那步吧。人到三五,一事无成的福川。总是把各种问题归咎于自然。生活各种不顺以及中年危机的即将到来,让他越发暴躁。 这天他与妻子离婚后,夜晚便与一群狐朋狗友,伶仃大醉。借着火酒劲以及不顾朋友的劝阻,他执意醉酒开着他的破捷达。 酒后开着的车总是摇晃不定,有惊无险。不知开了多久,借着月光与昏暗的车灯来到了一处田埂与山间的小路。 懒得开导航的他也就这么一直顺着这条路一直走,不管对与不对,他都就这么一直开着。 直至有道幻音传入他耳中,这声音告诉他,如果想改变现在的状况,就朝着这条路一直走。 不知是酒精的原因胆子大,或者是他此时脑袋一时想不开。便真的按着这声音的一直往这条路深处开去… 流水线工人意外穿越至异界,开启了他的一段传奇人生。 天才画家名声大噪, 赶稿收尾意外魂穿, 全新世界,精彩绝伦, 少年叶舟志在苍穹, 决心修炼,试图逆转乾坤, 贵人助修,命运天翻地覆, 巧夺阴阳造化,涅槃自命生死, 轮回掌控命运,超脱蜕凡成仙, 驻足位面之巅,双手,号令苍穹!顾凡,天命之子,前世他渡劫失败,怀着遗憾重生平行世界,再回天门,灵气复苏后,觉醒虚无道体的他,重新修炼,再踏巅峰,且看他如何争霸世界。证道道帝。【作者练手文】 懒得介绍农村题材生活I am god! 无知凡人们,献上你们的膝盖吧! 那一天,得知世界真实的辰桓定下一个小目标,成为这世间第一个神! 于是乎,受命于天的他带着上天的馈赠,开始了他收集打工人的历程。 赢飞羽穿越大秦,开局年仅五岁半。 还好身携熊孩子系统,只要不断搞事就能获得奖励。 “什么?系统你说我爹是秦始皇?” 当得知自己竟是嬴政流落在外的第二十四子时,赢飞羽惊了。 为了大秦不再二世而亡,也为了自己的小命,赢飞羽只好出手为嬴政逆天改命,导演沙丘宫之变! 嬴政:“好孩子,跟朕回宫,宫里好吃的多的很!” 小正太:“有泡面吗?” 当代大儒:“小公子,咱们今天学四书!” 小正太:“你瞧瞧我倒背的如何?” 第一武将:“小公子,臣来教你几招!” 小正太:“还是我先给你表演一个空手舞石狮子吧!” 嬴政:“赵佗造反,谁去平定?” 百官:“小公子文能提笔安天下,武能马上定乾坤!” 小正太:“别急!容我先练一只特种兵!” 原本只想作妖混个系统奖励,不曾想竟被秦始皇当做接班人培养! 意外穿越到了两千年前的西汉,我感觉自己很牛逼,且看哥如何风骚。
十雄传 民间秘闻录 元宇宙:开局进入西游争霸世界 王者荣耀之天才少年 欲何 都市超级医仙 以气至上 重生高武:老姐提我去上学 大明千王 宇宙星河之地平线下 末日:黎明的曙光 配音演员的奋斗 都市之最强武帝修真者 梵修罗Ⅱ轮回六道 人生陆漫漫,乔木不可栖 赘婿竟然是BOSS 一百年后的人生 穿越从无敌开始 神魔守护者 荒事 汶上强盛驾校地址 通渭县有学b2的驾校吗 太原丰峰驾校校长 韦斗路鹏翔驾校 汶上强盛驾校地址 汶上强盛驾校是什么车 汤阴县诚信驾校 太原安盛驾校的校长 汶上强盛驾校电话 太原安盛驾校可靠吗 天津北仓驾校电话 天津a2增驾驾校电话 汶上县强盛驾校地图 通渭县有学b2的驾校吗 巫溪摩托车驾校多少钱 韦斗路鹏翔驾校 汤阴县诚信驾校 汶上强盛驾校电话 天津北仓驾校科二时间 巫溪宁安驾校报名费 通渭县有学b2的驾校吗 巫溪有哪些摩托车驾校 渭南驾校学费 通渭哪个驾校好 同安驾校那里包过拿证 汶上县强盛驾校地图 汶上强盛驾校电话 渭南驾校学费 天津北仓驾校科二时间 汶上强盛驾校电话 韦斗路鹏翔驾校 通渭县有学b2的驾校吗 潍坊市青州盛华驾校 巫溪摩托车驾校多少钱 汶上强盛驾校怎么样? 韦斗路鹏翔驾校 潍坊市青州盛华驾校 太原丰峰驾校校长 汶上县强盛驾校地图 巫溪有哪些摩托车驾校 旺通驾校地址 太原安盛驾校可靠吗 巫溪民心驾校学费 汤阴县诚信驾校 通渭哪个驾校好 通渭县有学b2的驾校吗 天津a2增驾驾校电话 旺通驾校地址 汶上县强盛驾校地图 太原丰峰驾校的老板 亚星游戏官网 亚星官网 亚星官网 亚星游戏官网 亚星官网 神隐之城 我名:恒生 凡间九生 武者修罗 理想国的破灭 万利官网 皇冠登3出租 百家乐官网 万利官网 欧博官网 巫溪摩托车驾校多少钱 天津北仓驾校科二时间 通渭哪个驾校好 通渭哪个驾校好 汶上强盛驾校电话 汶上强盛驾校电话 天津北仓驾校科1时间 巫溪民心驾校学费 汶上强盛驾校怎么样? 通泰驾校小车教练 太原安盛驾校的校长 渭南驾校学费 汶上县强盛驾校地图 通渭县有学b2的驾校吗 汶上强盛驾校电话 太原安盛驾校总校电话 天津北仓驾校科二时间 天津北仓驾校科1时间 通泰驾校小车教练 通泰驾校小车教练 汶上强盛驾校地址 汶上强盛驾校电话 天津北仓驾校电话 天津北仓驾校科二时间 汶上强盛驾校是什么车 汶上县强盛驾校地图 巫溪有哪些摩托车驾校 太原安盛驾校如何 天津北仓驾校电话 通渭那个驾校能考试