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 in Bootstrap utilizes 12 columns that render out at widths of 724px, 940px (default without responsive CSS included), and 1170px. Below 767px viewports, the columns become fluid and stack vertically.

<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

p>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="span6">
        Level 1 column
        <div class="row">
            <div class="span3">Level 2</div>
            <div class="span3">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>

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>

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: 767px) { ... }
  /* Portrait tablet to landscape and desktop */
  @media (min-width: 768px) and (max-width: 979px) { ... }
  /* 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 hiding 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
宝宝的脚脱皮怎么办宝宝吃什么富含维生素离婚老公要抱宝宝跳楼未满一岁的宝宝会得癫痫吗1岁宝宝干咳没痰该吃什么药好宝宝的脚脱皮怎么办一岁宝宝感冒发烧出汗离婚老公要抱宝宝跳楼一岁半宝宝拉肚子有点不消化六个月的宝宝吃多少克米粉一岁宝宝四肢稍离婚老公要抱宝宝跳楼宝宝出生一周的食量一岁宝宝四肢稍离婚老公要抱宝宝跳楼孕20周宝宝鼻骨28周宝宝在的右侧肚子疼小宝宝摸妈妈的1岁宝宝干咳没痰该吃什么药好5个月宝宝急性肠胃炎生完宝宝重返职场小宝宝摸妈妈的一岁半宝宝拉肚子有点不消化1岁宝宝额头磕软包剖腹产宝宝出生后宝宝吃甘蔗卡住呕吐剖腹产宝宝出生后一岁宝宝发烧退烧药可以吃几次5个月宝宝急性肠胃炎做三维如何让宝宝把脸转过来上古大陆,一位拥有先天全体的少年,因为一次意外,引得黑珠入体,从而导致元力全失,至此他失去了所有光彩,族人的陷害让他认识了师尊,在一个分身的教导下,少年披荆斩棘,过五关斩六将,一步步成为真正的强者...... 为了家族命运,少年踏上了独自修炼的征程;为了亲人,他被迫选择了自己不爱的人;为了爱人,他忍受了无数年的自责。 从一个小小的战士,逐步成长为天元大陆至高无上的古神,而最终,为了整个天元大陆,他却付出了所有......九龙大陆,强者为尊,武道一途,与天争命,且看一朝皇子,凭三尺长剑,如何皇临天下!武道巅峰,谁为皇? 为了心中的一丝执念,阳炎勤修武,争太子,夺皇位,战天下,历生死,证武道,破轮回! 号令天下,莫敢不从!没有永远的和平,也没有永远的战争。 要想努力的活下去,只有变得更强。苏祈因为玩了一次笔仙游戏就被拽进了一个诡异的门后世界…… 这个世界,没有规则,没有对错,除了活着,没有别的选择。 轮回的教室,充满了笑声的楼梯间,尸块堆积的地下仓库。 同学接二连三的惨死却引发了更大的祸端,大门仍然是关闭的,游戏仍然在继续。 只有苏祈知道,自己病了,病的很重。 当他彻底无法控制病症之后,整个诡异世界,都会感受到真正的恐怖……未知的王朝,未知的身世, 内有皇储之争,外有敌国环伺, 作为没落家族子弟, 该何去何从? 风雨飘摇的乱世, 人命如草芥的时代, 在社会底层苦苦挣扎的人, 又该如何主宰自己的命运? 说穿越就穿越!担当主角替身,帮他拯救世界! 凭借系统外挂,一路逆袭,疯狂打脸! 玄妙功法,我的! 天材地宝,我的! 林天表示:自己实在是太喜欢这样的生活了!初中生创作,写的不好请谅解清末,重生南洋异国,身为皇明汉裔,勇搏时代浪潮,智斗恶邻列强,复我先祖荣光,兴我华龙血脉,建我盛世邦国,立我汉明神威。慕容晓的父母已音讯全无三年有余,她甚是迷茫。在得到了师父无音师太的首肯之后,她决定亲自下山前去瓒州一探究竟。可谁曾想到,慕容晓刚一下山便遇到了重重阻碍。她和她的朋友们能否安然抵达瓒州?这一路上又会有什么巨大的阴谋在等着她?人在江湖有时真的是身不由己。是抱有希望继续向前?还是与伙伴们荣辱与共?慕容晓的心中已经有了她自己的答案…“岳白,岳白你醒醒” 岳白睁开眼睛发现这是一个完全陌生的世界……
路人系统之命运重生 重塑旧时光 西兴山村 超级僵尸先生 元宇神话纪年 穿越之我在南宋那些事儿 起元 造化魔神系统 圣域九歌 欲摆烂李二不让 我比灵气先复苏 第一念元素 我的兄弟是警察 沉楼 重睹天日 创天主宰 道心人间 特工孤儿院 金域藍城 创世天傲 宝宝吃甘蔗卡住呕吐 孕20周宝宝鼻骨 宝宝2岁断奶注意事项 1岁宝宝干咳没痰该吃什么药好 宝宝吃什么富含维生素 一岁宝宝发烧退烧药可以吃几次 宝宝2岁断奶注意事项 宝宝口腔炎反复发烧怎么办 冬天宝宝连体衣里面穿什么 宝宝出生一周的食量 出生13天宝宝肚脐眼用什么擦拭 出生13天宝宝肚脐眼用什么擦拭 1岁宝宝额头磕软包 孕20周宝宝鼻骨 宝宝的脚脱皮怎么办 剖腹产宝宝出生后 产检都做了为什么宝宝还是有缺线 宝宝吃甘蔗卡住呕吐 宝宝中午胎动比较频繁 离婚老公要抱宝宝跳楼 孕20周宝宝鼻骨 离婚老公要抱宝宝跳楼 宝宝中午胎动比较频繁 小宝宝摸妈妈的 六个月的宝宝吃多少克米粉 十三月宝宝一天辅食时间顺序 宝宝吃甘蔗卡住呕吐 宝宝中午胎动比较频繁 宝宝中午胎动比较频繁 冬天宝宝连体衣里面穿什么 1岁宝宝干咳没痰该吃什么药好 九个月的宝宝拉屎带血吃什么好 未满一岁的宝宝会得癫痫吗 宝宝的脚脱皮怎么办 1岁宝宝额头磕软包 剖腹产宝宝出生后 未满一岁的宝宝会得癫痫吗 宝宝2岁断奶注意事项 1岁宝宝额头磕软包 1岁宝宝需要补充什么 剖腹产宝宝出生后 宝宝口腔炎反复发烧怎么办 5个月宝宝急性肠胃炎 产检都做了为什么宝宝还是有缺线 一岁宝宝四肢稍 九个月的宝宝拉屎带血吃什么好 出生13天宝宝肚脐眼用什么擦拭 剖腹产宝宝出生后 十三月宝宝一天辅食时间顺序 28周宝宝在的右侧肚子疼 亚星官网 亚星官网 亚星官网 亚星官网 亚星游戏官网 禹行录 玄幻:说书九龙拉棺,修炼界炸了 我带着面板在诸天轮回 掠刀 西游:人在地府,朝九晚五 亚星管理平台 葡京官网 AG真人 亚星管理平台 万利官网 宝宝出生一周的食量 未满一岁的宝宝会得癫痫吗 一岁半宝宝拉肚子有点不消化 一岁半宝宝拉肚子有点不消化 1岁宝宝干咳没痰该吃什么药好 小宝宝摸妈妈的 离婚老公要抱宝宝跳楼 宝宝口腔炎反复发烧怎么办 一岁宝宝四肢稍 产检都做了为什么宝宝还是有缺线 宝宝吃什么富含维生素 未满一岁的宝宝会得癫痫吗 孕20周宝宝鼻骨 宝宝中午胎动比较频繁 1岁宝宝干咳没痰该吃什么药好 一岁宝宝发烧退烧药可以吃几次 未满一岁的宝宝会得癫痫吗 1岁宝宝需要补充什么 出生13天宝宝肚脐眼用什么擦拭 出生13天宝宝肚脐眼用什么擦拭 1岁宝宝干咳没痰该吃什么药好 1岁宝宝干咳没痰该吃什么药好 离婚老公要抱宝宝跳楼 1岁宝宝需要补充什么 小宝宝摸妈妈的 孕20周宝宝鼻骨 一岁宝宝感冒发烧出汗 冬天宝宝连体衣里面穿什么 宝宝的脚脱皮怎么办 生完宝宝重返职场