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岁宝宝经常抠鼻子性高潮长时间宫缩宝宝会缺氧吗四维彩超感觉宝宝眼距宽呢2016猴宝宝姓名大全男孩宝宝肛周脓肿术后有硬块1岁半宝宝吃肉松性高潮长时间宫缩宝宝会缺氧吗两岁的宝宝还需要补钙吗?40天的宝宝总是放屁四五个月宝宝后脑不平图性高潮长时间宫缩宝宝会缺氧吗出生20天宝宝鼻塞四五个月宝宝后脑不平图三维b超和宝宝真实照片对比40天的宝宝总是放屁二十多天宝宝大便颜色宝宝为什么听懂话又不愿说出来?2016猴宝宝姓名大全男孩1岁宝宝老是饿怎么回事宝宝超重如何减肥宝宝为什么听懂话又不愿说出来?两岁的宝宝还需要补钙吗?七个月宝宝每次吃都哭闹不肯吃三个月胎宝宝是怎样的4维后对宝宝有什么影响三个月胎宝宝是怎样的七个月宝宝每次吃都哭闹不肯吃1岁宝宝老是饿怎么回事出生20天宝宝鼻塞这世间本就杂乱无章。充满着太多未知的事物,科学暂时无法解释的,存在争议的事件。我都对此充满着好奇,红斑的出现,就像一把钥匙。打开了另一个世界的大门,一个21世纪的失意少年,不幸失足落水。灵魂穿越到了一个仙魔共存的时代,重生在一个修真世家里面。看他如何一步步反转,走上巅峰!父亲早故,母亲再嫁,从小和外婆生活长大,高考落榜被外婆送到万仞山隐芳门学成隐世本领,旅途善行再遇高人传授谋生绝技。回到久别的故乡继承破败的家业,正式开启人生的征程人-----------父母之仇,断指之痛! 少年凌宇,手指在被斩断之后,逆天重生,而这一根手指,竟拥有着改天换地之能。一个贫苦的年轻人...... 一支可画万物的笔...... 一个又一个的未解之谜,传说、民间灵异、外星科技...... 逆袭的路上充满荆棘,不畏权贵,惩奸杀恶痛快淋漓。 纵横都市偷心各类美艳佳人,上演一部叱咤天地的不朽传奇!主角羽诺从虚无的静湖之上醒来,竟发现了与自己长相相似,特征却并不相似的人,突然惊醒,再次醒来则是在一片灰色的荒漠,另一个自己也从此出现,自称为罪,不仅复活了三名昔日挚友,就连他们身心也发生了改变。 在另一个自己罪的指引下,羽诺带领三名挚友不断挑战荒漠的恐怖之物,不断的攀爬,最终抵达终点,罪也向羽诺表明了自己的目的,监管整个原世界。 黑白无常是我兄弟,牛头马面对我言听计从,娶阎王爷的闺女…… 人间有法医、警察,阴间有阴差、判官,阴阳之间自有他们无法触碰的地方,这就需要渡灵法医出马。 地狱空荡荡,魔鬼在人间。 诸多诡案背后,牵扯出阴司的巨大阴谋——这些参杂着巨大冤屈的灵异案件,竟然是阴司专管阴差的判官司主管崔钰。 权力之争古今存在,阳间如此,阴间亦如此。 商界天才在车祸中丧生,却意外重生在一个底层小人物体内。 时间倒退二十年,突然多了一个可爱女儿,该哭还是该笑?老婆这么漂亮,会不会不安全? 这是一个满地黄金的时代,机遇多如星辰密布,淘金者多如过江之鲫。 林皓文决定彻底释放野性,化身一头吸金巨兽。 林皓文:“各位商界大佬你们好,我是来教你们做人的。”乱世佳人从亡灵开始逆袭之路。“快来救我,我被困在相亲对象家的棺材里了!” 接到这个电话的吴邪和谢小花一脸懵逼。 现在小年轻都玩的这么花? 棺材? 还把自己困进去了? 而当他们根据地址赶来之后,却险些丧命于这看似普通的店铺当中! 最后找到了霍秀秀,却也没办法将其解救。 即便是暗中保护的小哥和吴三省也手足无措。 反而是差点被守护的扎纸人给一刀两断! 在这危急万分的时刻,阴风四起,一顶纸人抬轿停在了门口...... 多年以后。 霍秀秀注视着陌上少年:“扎纸匠、赶尸人、阴阳先生.....顾言,你到底还有多少身份啊?” 顾言腼腆的笑了笑,“方方面面都懂亿点吧!”
亡者恸夜 本公子讲歪道理,你讲什么 次元草书 时中梦醒 绝世神丹 流光之域 空间兑戒 焚尸间签到三年,我无敌了 这个世界不正经 最强精神病! 剑眼 初中生意外之旅 六国:起始 小飞侠李可可屠龙记 假如人生重来 神魔 入侵 冰山美女的最强兵王 奇幻世界之觉醒者 拎着镐把欺负鬼 仙魔:我拥有雷神体质 两岁以内宝宝坐飞机 20天宝宝消化不良 二十多天宝宝大便颜色 2016猴宝宝姓名大全男孩 两岁以内宝宝坐飞机 宝宝痢疾能不能吃母乳 二十多天宝宝大便颜色 20天的宝宝便秘 4维后对宝宝有什么影响 双歧杆菌一岁宝宝吃多少 36周做四维可看清宝宝 36周做四维可看清宝宝 宝宝一岁半这俩天不怎么吃饭 20天宝宝消化不良 宝宝肛周脓肿术后有硬块 2016猴宝宝姓名大全男孩 宝宝水痘眼肿 4维后对宝宝有什么影响 十月宝宝每天作息时间 性高潮长时间宫缩宝宝会缺氧吗 20天宝宝消化不良 性高潮长时间宫缩宝宝会缺氧吗 十月宝宝每天作息时间 宝宝为什么听懂话又不愿说出来? 40天的宝宝总是放屁 宝宝一岁半这俩天不怎么吃饭 两岁以内宝宝坐飞机 1岁宝宝经常抠鼻子 十月宝宝每天作息时间 4维后对宝宝有什么影响 2016猴宝宝姓名大全男孩 宝宝出生后每个月的变化? 四维彩超感觉宝宝眼距宽呢 宝宝肛周脓肿术后有硬块 七个月宝宝每次吃都哭闹不肯吃 三个月胎宝宝是怎样的 四维彩超感觉宝宝眼距宽呢 二十多天宝宝大便颜色 宝宝一岁半这俩天不怎么吃饭 三维b超和宝宝真实照片对比 三个月胎宝宝是怎样的 20天的宝宝便秘 宝宝什么时候吃ad滴剂 宝宝水痘眼肿 四五个月宝宝后脑不平图 宝宝出生后每个月的变化? 36周做四维可看清宝宝 三个月胎宝宝是怎样的 宝宝一岁半这俩天不怎么吃饭 五个月宝宝躺着老使劲想起来 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 只有我是正常人! 桐湖秘境 仙人不长生 枢星 想飞的水滴在地里 亚星游戏官网 万利官网 欧博游戏官网 亚星游戏官网 葡京官网 两岁的宝宝还需要补钙吗? 十月宝宝每天作息时间 七个月宝宝每次吃都哭闹不肯吃 四五个月宝宝后脑不平图 出生20天宝宝鼻塞 三维b超和宝宝真实照片对比 20天宝宝消化不良 宝宝什么时候吃ad滴剂 1岁半宝宝吃肉松 宝宝为什么听懂话又不愿说出来? 1岁宝宝经常抠鼻子 1岁宝宝经常抠鼻子 二十多天宝宝大便颜色 宝宝水痘眼肿 双歧杆菌一岁宝宝吃多少 1岁半宝宝吃肉松 40天的宝宝总是放屁 宝宝超重如何减肥 宝宝痢疾能不能吃母乳 宝宝为什么听懂话又不愿说出来? 双歧杆菌一岁宝宝吃多少 4维后对宝宝有什么影响 宝宝出生后每个月的变化? 1岁宝宝老是饿怎么回事 1岁半宝宝吃肉松 2016猴宝宝姓名大全男孩 十月宝宝每天作息时间 十月宝宝每天作息时间 宝宝出生后每个月的变化? 宝宝出生后每个月的变化?