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
银川到青岛火车票卧铺北京火车站到三路居河北到莱芜的火车站银川去武汉的火车票淄博到珠海的火车站时刻表银川到青岛火车票卧铺曲请到富源火车时刻表河北到莱芜的火车站观光火车路线图嘉善到达州的火车票深圳东火车站电话多少钱一个月河北到莱芜的火车站义乌到象山火车票深圳东火车站电话多少钱一个月麻城至广州站火车票查询嘉善到达州的火车票滁州到郑州火车途经百色田阳县有火车嘛淄博到珠海的火车站时刻表白城到长春火车软卧聊城到盘锦火车票查询百色田阳县有火车嘛观光火车路线图临高县火车站咨询电话蓝村诸城的火车站列车时刻表利川到徐州的火车票查询蓝村诸城的火车站列车时刻表临高县火车站咨询电话白城到长春火车软卧义乌到象山火车票年轻的拳王重生,带着上一世神奇的力量,看他如何纵横哈利波特世界人类啊,一个渺小又伟大的族群。他们黑暗,他们光明。他们肮脏,他们神圣。他们愚笨,他们聪慧。他们是诸天万族最大的矛盾结合体。他们诞生过很多让我记住名字的人,那些人比我们更像神明。 —混沌离星域安东神。穿越玄幻世界的姜恒,觉醒潜能升级系统,可用潜能点无限升级修为和功法。 【铜像功】升级为【万劫不灭金身】 【疾风步】升级为【虚空大挪移】 【追光剑】升级为【灭天绝地斩神剑】 【碎岩拳】升级为【寰宇大绝灭】 修为:凡境升级为真神境 直到某天。 姜恒身躯一震,虚空破碎,法则紊乱! 一拳轰出,星辰陨落,漫天神魔尽皆湮灭! 本书又名:《开局揍哭小师妹,我升级了!》《越级刷怪升级真快》柳一,吃的用的都是自认为最干净,包括女人。十四年前,陌生少年初次来到这片陌生的时空。十四年后,少年踏上修玄之路。父母离奇失踪,世界暗流涌动,北界风起云涌,且看南宫清如何乘风破万里浪,纵横玄天大陆! 穿越封神! 叶轩发现自己穿越成为了商纣王。 并且做下(银)诗,调戏了女娲。 面对暴怒的女娲,叶轩在心中对始作俑者准提圣人暗恨不已。 却不想被女娲偷听了心声。 女娲当即邀请他,共讨西方准提。 站在西方大须弥山,作为人皇的他,对准提圣人破口大骂。 并悉数准提圣人多条罪状。 一时间洪荒皆惊。 关键时刻,叶轩觉醒了鸿蒙赶尸系统。 诸多以役强者的尸体尽皆被他奴役。 学会赶尸的他,从此洪荒天地任逍遥! 祖龙,元凤,始麒麟,成为了他的保镖。 十二祖巫,成为了他的宠物。 兽皇神逆,魔祖罗喉,成为了他的打手。 面对众多死去已久的强者,洪荒众生瑟瑟发抖! (不一样的纣王,不一样的封神,简介无力,请移驾下文!) 事故之后,我竟转生成为了异世界魔物? 这是一个魔法的世界,帝国纷争,城邦联合,神秘力量的苏醒改变着着世界的方向,不受时间消磨的“永恒星碑”上记载的过去引起着世界的动荡...... 在异世界苏醒后成为了魔物,伪装成人类走向人类世界,学习魔法,增强实力,游历各地探索这精彩异世界的奥秘!何为末世?丧尸?魔怪?虫族?不!唯有当人类所恐惧的,所崇拜的,甚至是所幻想的一切都成为现实之时,才是人类真正的末日!灵气回涌,信仰重铸,这是神佛妖魔的饕餮盛宴,也是人类有史以来的最大浩劫!丧尸,异形,贞子,怪形,妖精鬼怪,神魔仙佛,这一切的一切,都将降临于世!这是真正的末日,这是末世……神魔纪元!——————这是不冷的第四本书,已完本三本共1500W字小说,无太监,人品保证,新书期急求支持!加更规则:打赏满100加更一章,鲜花满1000加更一章,加更的章节会在上架后爆发!任何生物受到攻击,都会感到疼痛,害怕,或是露出破绽,但是,艾斯不会有那种感觉。 ——亚波人结社联盟,络网聚伙,号曰荡吧,颇成规模。中有孙者悟空,传闻乃为辽东人氏,及以草创之际沥血呕心,不为其功,熟料事业将成,卓然为粪首佛头,蛊惑盲流,立为一叚,东引祸水,西惹它言,今番已为群盗者之首也。我等众人,勠力同心,歃血而誓,诛此内贼,清平寰宇。余之有幸,得以著笔,跋序檄文,列书荟萃,集万千同袍之心,汇集新著,笔墨为矢,文言为锋,以此起兵,共讨瑕玊之蜮,故名为《讨孙平叛传》
荣耀化神 极点世界 龙神不休 我真的不是无敌的 侠匠一侠傲天穹 我的朋友是创世神 大夏执剑人 回乡的奇妙之旅 浮世之间 俏无常 法医的秘密 太荒至尊诀 末世魔潮 少年时之九零后 成为恶蛟加点修仙 九幽练魂决 剑指云水间 娘子刚登基,我就成了全民公敌 穿越异界魔王 大明写尸人 邢台到曹县的火车时刻表查询系统 银川去武汉的火车票 嘉善到达州的火车票 长沙到武汉高铁火车票 邢台到曹县的火车时刻表查询系统 观光火车路线图 嘉兴到广西的火车票 淄博到珠海的火车站时刻表 邢台一北京西火车票多少钱 百色田阳县有火车嘛 义乌到象山火车票 义乌到西安的火车卧铺时刻表查询 科右中旗至通辽的火车时刻表 银川去武汉的火车票 利川到徐州的火车票查询 长沙到武汉高铁火车票 嘉兴到广西的火车票 邢台一北京西火车票多少钱 曲?到富源火车时刻表 新县至郑州火车时刻表查询 银川去武汉的火车票 临高县火车站咨询电话 滁州到郑州火车途经 河北到莱芜的火车站 蓝村诸城的火车站列车时刻表 科右中旗至通辽的火车时刻表 邢台一北京西火车票多少钱 滁州到郑州火车途经 曲?到富源火车时刻表 邢台一北京西火车票多少钱 长沙到武汉高铁火车票 银川去武汉的火车票 鲅鱼圈至大连火车票 利川到徐州的火车票查询 聊城到盘锦火车票查询 长沙到武汉高铁火车票 鲅鱼圈至大连火车票 嘉善到达州的火车票 科右中旗至通辽的火车时刻表 临高县火车站咨询电话 白城到长春火车软卧 百色田阳县有火车嘛 长沙到武汉高铁火车票 邢台到曹县的火车时刻表查询系统 深圳东火车站电话多少钱一个月 去东海的火车站时刻表 邢台一北京西火车票多少钱 蓝村诸城的火车站列车时刻表 鲅鱼圈至大连火车票 曲?到富源火车时刻表 亚星游戏官网 亚星官网 亚星官网 亚星官网 亚星官网 传统玄幻之九龙杯 最后人类 扶手云烟笑 人道曙光 我夺舍了魔道祖师爷 欧博官网 百家乐官网 亚星管理平台 欧博官网 亚星游戏官网 去东海的火车站时刻表 百色田阳县有火车嘛 聊城到盘锦火车票查询 去东海的火车站时刻表 嘉兴到广西的火车票 观光火车路线图 嘉兴到广西的火车票 河北到莱芜的火车站 曲请到富源火车时刻表 河北到莱芜的火车站 新县至郑州火车时刻表查询 麻城至广州站火车票查询 滁州到郑州火车途经 淄博到珠海的火车站时刻表 邢台到曹县的火车时刻表查询系统 新县至郑州火车时刻表查询 观光火车路线图 邢台到曹县的火车时刻表查询系统 银川到青岛火车票卧铺 邢台一北京西火车票多少钱 科右中旗至通辽的火车时刻表 长沙到武汉高铁火车票 北京火车站到三路居 观光火车路线图 利川到徐州的火车票查询 嘉兴到广西的火车票 淄博到珠海的火车站时刻表 义乌到西安的火车卧铺时刻表查询 临高县火车站咨询电话 兰州至义乌火车路线