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
重庆江北大石坝快递电话号码诏安邮政快递电话重庆江北大石坝快递电话号码郑州圆通分拣中心电话郑州德邦物流公司地址电话舟山普陀区快递电话号码多少钱织里圆通电话客服人工重庆江北大石坝快递电话号码邮政中国邮政快递电话客服电话中国邮递电话中国际邮政快递查询单号查询电话重庆江北大石坝快递电话号码知道邮箱怎么查电话号码郑州德邦物流公司地址电话号码查询朱解邮局电话中国邮递电话邮政政务中心电话郑州德邦物流公司地址电话号码郑州德邦物流公司地址电话号码舟山普陀区快递电话号码浙江杭州电话号郑州德邦物流公司地址电话号码邮政中国邮政快递电话客服电话舟山定海城东顺风快递电话号码郑州德邦物流公司地址电话重庆云阳县 电话郑州圆通分拣中心电话舟山定海城东顺风快递电话号码舟山普陀区快递电话号码知道邮箱怎么查电话号码灵气复苏,山海真祖镇压当世一切敌,时过千年,高中生王毅背负山海经,是宿命,还是使命?主角羽诺从虚无的静湖之上醒来,竟发现了与自己长相相似,特征却并不相似的人,突然惊醒,再次醒来则是在一片灰色的荒漠,另一个自己也从此出现,自称为罪,不仅复活了三名昔日挚友,就连他们身心也发生了改变。 在另一个自己罪的指引下,羽诺带领三名挚友不断挑战荒漠的恐怖之物,不断的攀爬,最终抵达终点,罪也向羽诺表明了自己的目的,监管整个原世界。带着200级三转大法师的记忆,陆阳重生回到了十年前,命运跟他开了一个玩笑,曾经失去过的,被夺走的,他都要重新拿回来。游戏中的赚钱技巧、副本攻略、传奇任务、装备出处、图纸秘方、战斗技巧他全都知道,且看一个重生玩家如何带着兄弟们横扫万国、焚尽天下,开启一段火神的传奇!李言在某个夜晚入睡时发现自己进入到了一个未知的世界,在这里,他将开始自己的冒险睁开眼,林浩强重生到和妻子离婚的当天。 上一世的他,五毒俱全,抛妻弃女。 弥留之际的他,得知老婆积劳成疾,早已亡故,女儿叛逆,十年牢狱之后,死于街头。 林浩强死不瞑目。 上天给了他一个重生的机会,还给了他一方小世界。 为了弥补上一世的罪孽,林浩强起早贪黑,拼命工作,把老婆和女儿宠上了天。未来世界,一款名为超神空间的游戏横空出世! 人类可以自由进入超神空间,进行修炼升级打宝炼器,并且能在虚拟和现实中自由穿梭,将游戏中的等级和宝物带回现实! 沈明为了救治母亲的癌症,踏入超神空间寻找药物,逐渐从一个人人喊打的小人物,成长成为天下无双的万界之主! 林长安,幼年家人离散,踏上寻亲之路。 血刀堂、镇武司... 麻烦?助力?接踵而来 ......燕京大学学生柳云飞,因旅游遇险误入魔法世界,而在那里获得种种奇遇和能力,他是全魔法属性的天才,他让魔法界统一,因缘巧合之下解开了魔法和仙术同源的秘密。返回地球后,他又使魔法和科技相结合,令华夏国的科技飞速发展,并和外星人展开激烈大战。书中有绚丽的魔法、有先进的科技、有缠绵的情爱、有残酷的战争能满足不同口味读者的阅读欲望。 不可明状的存在将地星扩大一百倍,整个世界都被游戏数据化。 远古的存在开始回归,混沌中有异族在蠢蠢欲动。 这是大秦猛卒与盛唐羽林军的争霸,也是魏武卒与陷阵营的碰撞。 当斯巴达勇士遇上黄巾力士,当教廷的十字远征军碰上蒙古铁骑...... 象兵、铁浮屠、维京海盗......人类、兽族、异族侵袭....... 谁,才是诸天最强文明?于封本是一个国家神秘研究中心的一名工作人员,但死亡之际却神奇的穿越回了神秘复苏一年前。 醒来后,他自带了神秘直播系统,成为了一名探灵主播。 从此,世界上多了一个与众不同的探灵直播间。 直播间日常: 【叮,主播发现特殊道具,开启隐藏任务】 【叮,主播收服女鬼,获得称号:女鬼征服者】 【观众:封哥?封爷!】 同时,直播间的视频传到外界,引起了轩然大波……
一个程序员穿越回大宋 田畯野老 天下之绝代 光遇, 留守儿童之阿礼 指纹名单 长城一号 轩傲九天 谋主天下 师姐请自重 死亡游戏:幸存者 透视小农医 开局选了恐龙族 地球篇天使降临 天道数亿层 大逍遥主宰 惊悚降临:从校花夜访开始 哥,你真霸道! 道士下山之都市修行 驱魂录前传 重庆顺丰南区路电话 郑州最惠物流老板电话 邮政政务中心电话 郑州德邦物流公司地址电话 重庆顺丰南区路电话 舟山定海城东顺风快递电话 邮政政务中心电话号码 枝江上门收快递电话 重庆云阳县 电话 知道邮箱怎么查电话号码 邮政中国邮政快递电话客服电话 邮政中国邮政快递电话查询 舟山普陀区快递电话 郑州最惠物流老板电话 舟山普陀区快递电话号码多少钱 郑州德邦物流公司地址电话 邮政政务中心电话号码 重庆云阳县 电话 浙江杭州电话号 重庆江北大石坝快递电话号码 郑州最惠物流老板电话 朱解邮局电话 诏安邮政快递电话 郑州德邦物流公司地址电话号码查询 中国邮递电话 舟山普陀区快递电话 重庆云阳县 电话 诏安邮政快递电话 浙江杭州电话号 重庆云阳县 电话 郑州德邦物流公司地址电话 郑州最惠物流老板电话 朱丽珍电话 舟山普陀区快递电话号码多少钱 舟山定海城东顺风快递电话号码 郑州德邦物流公司地址电话 朱丽珍电话 邮政政务中心电话 舟山普陀区快递电话 朱解邮局电话 郑州圆通分拣中心电话 枝江上门收快递电话号码 舟山普陀区快递电话号码多少 邮政中国邮政快递电话查询 郑州德邦物流公司地址电话号码查询 郑州最惠物流老板电话 邮政中国邮政快递电话查询 郑州圆通分拣中心电话 舟山普陀区快递电话 织里圆通电话客服人工 亚星官网 亚星游戏官网 亚星游戏官网 亚星官网 亚星游戏官网 佣兵1929 黑白通常 娱乐:从向往开始的巨星 风云前线 谁还没个外挂 欧博游戏官网 皇冠登3出租 百家乐官网 欧博游戏官网 亚星管理平台 朱解邮局电话 邮政中国邮政快递电话查询 邮政中国邮政快递电话查询 枝江上门收快递电话号码 知道邮箱怎么查电话号码 郑州最惠物流老板电话 中国邮递电话 郑州德邦物流公司地址电话号码 邮政政务中心电话 浙江杭州电话号 朱解邮局电话 中国际邮政快递查询单号查询电话 舟山普陀区快递电话号码 郑州圆通分拣中心电话 舟山定海城东顺风快递电话 中国邮递电话 重庆江北大石坝快递电话号码 邮政政务中心电话号码 邮政政务中心电话号码 郑州圆通分拣中心电话 郑州圆通分拣中心电话 舟山普陀区快递电话号码多少钱 郑州最惠物流老板电话 郑州德邦物流公司地址电话 邮政政务中心电话 知道邮箱怎么查电话号码 重庆江北大石坝快递电话号码 郑州德邦物流公司地址电话号码查询 邮政中国邮政快递电话客服电话 朱丽珍电话