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
漳州漳州小版邮票2016邮票预订时间蔡伦邮票正票价格光辉形象邮票柳毅传书邮票行情漳州漳州小版邮票国庆大典60周年邮票蔡伦邮票正票价格不带背胶邮票通州邮票交易市场在哪里关公邮票大版价格蔡伦邮票正票价格2017年7月邮票关公邮票大版价格英国珍贵邮票通州邮票交易市场在哪里九藏天下买的邮票好吗火猴迎新纯金邮票发行量是多少柳毅传书邮票行情鸡邮票的设计写话2016青岛邮票火猴迎新纯金邮票发行量是多少不带背胶邮票2013 1蛇邮票邮票背面有彩毛主席纪念堂邮票8分邮票背面有彩2000龙年邮票价格飞涨鸡邮票的设计写话浦发银行奔马邮票江湖有传,陈一的刀,楚狂的笑。 陈一,来历成谜的刺客,冷静坚忍,他的刀,能杀人,也能救人。 楚狂贺北沙,武功盖世,狂放不羁,然却身患奇症,每隔十五日,便需要服用灵药续命。 一日,贺北沙派人找上了陈一,因为,自己赖以续命的灵药被盗了,他们的故事,就从这里开始了……谁说经商耽误修炼,凭借商道,他便纳尽天下之物;谁说奕棋消弥意志,凭借奕道,他得了部上古奇书。 以此两道,最终成就了他的神行之路。他凭此一路披荆斩棘,高歌猛进,开启了铁血征战、跌宕起伏的人生之旅。 为聚天下财,他创立扬天商盟;为报血海仇,他鏖战惊天世家;为解万古迷,他踏遍九州天下;为登通天路,他摘尽日月星辰。 越开元,破灵台,入天元,成金丹,踏神境,戮上仙,终得天道。什么仙、神,都将匍匐在他的脚下…….(不定期更新,更文极慢,请莫期待) 天地之间,你我存一 人去仙来,渡后方知 仁心相崩,礼乐亦损 万生万物,劫后方新 他是弃婴他是小保安他只有二百块。他用神鬼莫测的医术活人无数,他凭一身武功历经凶险,他最终得成伟业名利双收。“什么是灵气?”冷瑞提出了疑问。学化学的他穷尽天地之秘,纵横诸天万界,横扫仙鬼神魔。一天高二学生王羽被奶奶叫回家中,告诉了他世界的真相和家族的秘密,从此走上修真之路这个小镇终年被团雾环绕,它将所有人都困在了原地。没人敢靠近它,它会让人麻痹,消融在雾气中…… 萧志昂,一个误闯渝水镇的外地少年。 第一次重生是遇到了刺杀,醒来后回到了来渝水镇的头一天,也就是死前第三天。 第二次重生是遇到了谋杀,醒来后回到死前第七天,而且他还发现只要不提羊子,不建议搜山,就不会死亡。 第三次重生到第六次重生是李桦娇遇险,萧志昂被枪击。但是每次醒来都是事发当下,一直到他找出那个背后的凶手才解除循环。 第七次重生是逃出搬运站,结果因为摘果子自投罗网,直接被送回了七天前,也就是第一次发现搬运站的这天。 随后,第八次、第九次、第十次重生则再次陷入循环,老是因为一头野猪而没法逃脱。 …… 这到底有什么样的规律呢?究竟要怎么样才能逃出渝水镇呢? 一次又一次的死亡,一次又一次的重生,终于他把每次重生后得到的线索汇聚到了一起…… 同时,他还发现,通过自己的不断探寻,渐渐也让身边的朋友拥有了超能力……我有毒,别碰我!我眼瞎,别逼我睁眼!我之毒,无人可解,我之眼,可判生死阴阳! 也不知从什么时候开始,男人的责任和压力小了。继而,出现了所谓的“X子男”,颠覆了现实生活,让人万万没想到......穿越到贞观十七年... 本欲摆烂,李二不干~ 李丽质:郎君之才,养你一生如何,尔无须努力了 李治:还请先生助我过桥! 李世民:我大唐有此先生,当兴!我请先生位列国公...
元素之子之踏破凌云 真的真的是游戏吗? 大唐最牛纨绔 大道无为之梦魇问世 光之巨人:我是迪迦 魔族公子 天下神少 我与死神画押 乡村公子 天人绝路 我用太祖长拳在魔宗修仙 奈何桥畔之彼岸花 废材极品纨绔 盘古地图 逍遥小王爷 非人六道 我的二十岁少年时代 重生:回到过去当医圣 恶龙?不存在! 孩子们i 2017年7月邮票 鸡邮票的设计写话 柳毅传书邮票行情 2015老虎大版邮票 2017年7月邮票 国庆大典60周年邮票 柳毅传书邮票行情 漳州漳州小版邮票 浦发银行奔马邮票 蔡伦邮票正票价格 关公邮票大版价格 关公邮票大版价格 邮票带走了家人的思念 鸡邮票的设计写话 不带背胶邮票 2015老虎大版邮票 火猴迎新纯金邮票发行量是多少 浦发银行奔马邮票 通州邮票交易市场在哪里 2016青岛邮票 鸡邮票的设计写话 2016香港邮票发行量 中国邮政发行南京青奥会纪念邮票 2013 1蛇邮票 丁酉年的邮票 邮票带走了家人的思念 浦发银行奔马邮票 中国邮政发行南京青奥会纪念邮票 通州邮票交易市场在哪里 浦发银行奔马邮票 2015老虎大版邮票 2014马年贺岁邮票 2016邮票预订时间 不带背胶邮票 九藏天下买的邮票好吗 2015老虎大版邮票 2016邮票预订时间 柳毅传书邮票行情 邮票带走了家人的思念 2016香港邮票发行量 毛主席纪念堂邮票8分 蔡伦邮票正票价格 鸡邮票的设计写话 环保邮票制作 关公邮票大版价格 台湾后赤壁赋古画邮票 环保主题的邮票 邮票背面有彩 2014马年贺岁邮票 九藏天下买的邮票好吗 亚星游戏官网 亚星官网 亚星官网 亚星游戏官网 亚星官网 这小哥能处,烂摊子他敢接 网游之修仙时代 尼尔:变形纪元 拥有系统的最强猎兽骑士 万道祖庭 欧博官网 亚星管理平台 澳门葡京游戏官网 欧博官网 亚星游戏官网 2017年7月邮票 九藏天下买的邮票好吗 国庆大典60周年邮票 火猴迎新纯金邮票发行量是多少 2015老虎大版邮票 鸡邮票的设计写话 关公邮票大版价格 台湾后赤壁赋古画邮票 火猴迎新纯金邮票发行量是多少 2016青岛邮票 台湾后赤壁赋古画邮票 中国邮政发行南京青奥会纪念邮票 环保主题的邮票 光辉形象邮票 蔡伦邮票正票价格 浦发银行奔马邮票 2016邮票预订时间 2000龙年邮票价格飞涨 2015老虎大版邮票 邮票带走了家人的思念 柳毅传书邮票行情 台湾后赤壁赋古画邮票 2000龙年邮票价格飞涨 不带背胶邮票 环保邮票制作 漳州漳州小版邮票 环保主题的邮票 2016香港邮票发行量 丁酉年的邮票 2016邮票预订时间