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
长春市绿园区供水电话长安区桃园工商分局电话长春市绿园区韵达快递电话长春市孟家派出所电话号码长春市南关区残联电话长春市绿园区供水电话博爱顺丰快递电话查询长春市绿园区韵达快递电话长安汽车总部服务电话博白县中通快递电话长春市汽车工业局电话长春市绿园区韵达快递电话亳州韵达快递电话号码长春市汽车工业局电话长春市绿园区韵达快递电话博白县中通快递电话博爱五马公司电话长春市南关区武装部电话长春市南关区残联电话长春市快捷快递电话长安汽车总站电话号码长春市南关区武装部电话长安汽车总部服务电话长春市北海路邮局电话长春市南关分局电话长安区韦曲派出所电话长春市南关分局电话长春经开工商局投诉电话长春市快捷快递电话亳州御花园 电话小丽?哪个小丽?咳!咳!就是你们知道的那个小丽! 小丽还是离开了这个物欲横流的沿海城市! 偌大的火车站,只留下小祥孤独的身影! 小张:你一个中职生,还玩脚踩两只船的把戏,玩就玩吧,还跟那种女人,滚吧! 父亲:畜生!你敢出这个家门,有本事就别回来~ 母亲:小祥,啥样的女孩,你不能挑?你偏偏选那种的,那种人能领进门吗? 女友的蔑视、父亲的痛骂、母亲的乞求~ 小祥还是毅然决然地坐上了去云贵的绿皮火车! 他要去跟他的青春告个别! 看一眼小丽,再看一眼她嫁的老实人! 朴素的婚宴上,小丽看到熟悉的身影,追着跑过来! 崎岖的山头,二人不慎失足,双双跌落山崖! 谁知,醒来时竟穿越到宋朝~ 叮!叮!叮! 【检测到宿主已穿越,赏赐宋朝百科全书一套!】前世残疾,死后进入地府因前世无功无过被判入人道。 连孟婆汤都没喝到,就遇到了旷世大战? 三千大世界,亿万小世界。从此王浩带着记忆修仙! 破天门,闯地府。纵有神兵千千万也难与我争锋。 我王浩只争此世,不看来生。 神鬼皆惧我,极意手中藏。我于当世立绝姿!消失五年的李家公子强势归来!获得异界逆天传承!超神医术,修炼法术,无极之眼自带透视,玩转都市,无往不利!20岁的我被转生到了新的世界,成为了无敌一般的存在横穿古今未来的巨大布局,万世寂灭即将来临,大千世界因果加身,神秘莫测,该如何一步步揭开真相。他,长生王者,为了却心愿,乘兴而归,甘愿伴她左右,护她周全。 为她,逆了天下,只为一言之诺,蓦然回首,踏血而歌! 为她,亡了诸国,只为一怒红颜,腥风血雨,血染皇城!杀戮世界降临,全球百亿人随机被投放到未知角落。 赵东发现,这是他看过的一本小说世界? 随后悲催发现,自己是小说里的反派。 “我确实想有钱,可这是杀戮世界,再多钱也没用啊!” 不过,他很快发现,知道剧情的滋味真不错。 “我反手就是开局掠夺机缘。” 于是乎,小说主角怒吼:这本来是我的机缘啊! 女主角:“赵东大神对我真好,又厉害,我以前误会他了,他是真心喜欢我的。” 众求生者:“赵东大神求抱大腿。” 于是乎,别人在杀戮世界挣扎求生,赵东却发现这里的小日子也不错。 古关道,修天道,正大道,神魔回避,万古长青,八方俯首仰望! 玄尊坠,化身器,一器镇万古! 杨森修古关,修魔界,万物铭记,一念化四界乱世纷争,诸国并起,群雄争霸! …… 且看一边陲小国废物皇子,如何逆转乾坤! 你有金戈铁剑,我有手枪大炮! 你有战马铁骑,我有坦克飞机! 你有飞鸽传书,我有手机电话! …… 什么?敌人已经攻入我国境内! 别急!取我方天画戟!啊呸~取我核弹来!看我端他老窝!怀揣着复仇的决心,凤源走上了一条未知的道路,在黑暗侵袭的各个宇宙,成为了他人的希望,而凤源自己的光又在哪里呢?
孽 场 风云大学 华夏巅峰崛起 谁可逆天 史上第一大反派 大明权相 千秋万古黄粱梦 我与道士的那些事 世界爱不爱我 海贼王:开局拜卡普为师 黑白无常叫我小先生 浊酒论剑 万界逆旅 网游之星觉逆世 我带着面板在诸天轮回 异界元素 争霸 在修仙世界努力御兽这件事 诛暗 尚武之地 太空奇妙物语 长春市净月有大桥外语电话号码 亳州御花园 电话 长安汽车总站电话号码 博白物流电话 长春市净月有大桥外语电话号码 长春市绿园区大成玉米办公电话 长安汽车总站电话号码 博爱五马公司电话 长春市快捷快递电话 博爱县许良镇顺风速度运电话 长安区桃园工商分局电话 长安区桃园工商分局电话 长春市绿园区韵达快递电话 亳州御花园 电话 长春市南关分局电话 博白物流电话 长安区ems快递电话 长春市快捷快递电话 长春经开工商局投诉电话 长春市南关区残联电话 亳州御花园 电话 长春市南关区武装部电话 长春经开工商局投诉电话 博贺顺丰电话 博爱顺丰快递电话查询 长春市绿园区韵达快递电话 长春市快捷快递电话 长春市北海路邮局电话 长春经开工商局投诉电话 长春市快捷快递电话 博白物流电话 亳州韵达快递电话号码 长春市汽车工业局电话 长春市南关分局电话 长春市绿园区供水电话 博白到东兴早车电话 长春市汽车工业局电话 长安汽车总站电话号码 长春市绿园区韵达快递电话 长春市南关区武装部电话 博白到东兴早车电话 博爱县许良镇顺风速度运电话 长春市孟家派出所电话号码 长安区ems快递电话 博贺顺丰电话 亳州韵达快递电话号码 长安区桃园工商分局电话 博白到东兴早车电话 长春市绿园区韵达快递电话 博爱五马公司电话 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 狼啸苍天 本宫要修仙 建座地府当后宫 万界收藏家 破坏前 百度 百度 百度 百度 百度 长春市南关区武装部电话 长春市净月有大桥外语电话号码 亳州御花园 电话 亳州御花园 电话 长春市绿园区供水电话 长春市绿园区供水电话 长春市北海路邮局电话 长春市南关区残联电话 长春市绿园区中通快递电话 亳州韵达快递电话号码 北京ems天桥营投部电话 长春市快捷快递电话 长春市孟家派出所电话号码 博爱五马公司电话 长春市绿园区供水电话 长安汽车总站电话号码 长春市净月有大桥外语电话号码 长春市北海路邮局电话 长安汽车总部服务电话 长安路电信小区物业电话 长春市南关区残联电话 长春市南关区武装部电话 长春市绿园区韵达快递电话 长春市孟家派出所电话号码 长春市汽车工业局电话 博白物流电话 博爱顺丰快递电话查询 长春经开工商局投诉电话 长春市绿园区韵达快递电话 长安汽车总站电话号码 亚星官网 亚星官网 万利官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网