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
2001邮票年册价格原版邮票对比再版2008邮票目录万隆会议邮票2010中国邮票2001邮票年册价格齐白石邮票筋票2008邮票目录北京奥运2008小型张邮票价格党十七大代表大会邮票2014-8邮票2008邮票目录编年信销邮票2014-8邮票上海民居20分邮票党十七大代表大会邮票孙中山诞生一百二十周年邮票95年邮票年册2010中国邮票2012邮票发行量1981鲁迅邮票95年邮票年册北京奥运2008小型张邮票价格癸巳年 邮票中国共产党成立90周年邮票j136邮票价格中国共产党成立90周年邮票癸巳年 邮票2012邮票发行量编年信销邮票秦小满穿越成了地主二代,本想当个败家子躺平,可总有人想夺他的粮、抢他的钱、要他的命。 “既然无法低调,那我就不装了。” 于是,大乾朝百官想巴结他、公主想嫁给他、皇帝想让贤给他,就连周边国家的王族都想跪下叫他“爸爸”求庇护。 可他真的只是想当一个闲散的败家子而已……二十年前,他被一代道门隐脉奇人所救。二十年后,他遵守师父遗命下山踏入何家,阴差阳错之下成为何家的女婿,内心从抗拒到默默守护,皆因那一纸婚约而起! 这里是一个名为天元大陆的地方,在这里没有炫迈的魔法,更没有斗气,真气等。有的只是繁衍到巅峰的灵力。等级为灵者、灵士、灵师、灵君、灵王、灵宗、灵皇、灵圣、灵尊、灵至尊。 赵全,应用化学及治金双料硕士,毕业后学无所用,无房无车无女友,穿越后遂为赵瑔,江西铅山赵家庄里正之子,时逢南宋末年,宋廷上下偏安一隅苟且偷安,赵瑔以所学创业,引领宋人时尚风标,一步跨入富豪行列,计划趁大宋终结前乘船下南洋占个地方做“南阳村长”赵家庄之福引来盗匪垂涎,赵瑔不得不自建民团以自保,前世宅男从无逐鹿天下的雄霸之心,以“草根”为荣,但世事难料,为获取心仪女孩青睐,赵瑔剽窃伟人诗词以“才子”之名不胫而走,高薪聘请工匠得“奢遮小官人”褒誉。锲而不舍想泡美艳无双的白莲教天母,率民团连破白莲教数城。白富美愿以身相许,赵瑔大手笔招揽安置流民,大举开拓宝岛台湾。葛皂山灵宝天尊到场“以客座首席长老”礼待,朝廷封赐忠武节度使”,当赵瑔一步步被罩上光芒四射的主角光环时该何去何从?率领武装到牙齿的龙神军暴们下南洋占地当村长?指挥天下无二的强大帆舰称霸四海殖民东西半球?还是挥师北上笑看火枪对决弓马?江竭,遭遇车祸成了植物人,不久后,却奇迹般的醒了,而这一切,都源于一种外星生物,也就是所谓的外星人……在末日来临的时刻,你与同伴手握解救世界的机会,你的选择会是什么?人类起源永远是个猜想,或者我这个猜想才是真正的样子。这本书描述了一位创世者如何创世并见证了地球人类的发展。通过他的见证,让我们更多的了解哲学,或者说了解天道天理。从2013年起,到2022年,何广祥从初中时的不良少年,经历各种沉浮,通过大量见闻,最终成为待业青年,被生活磨去了棱角和斗志,消极麻痹自己。然而,陈馨的出现,给了何广祥砥砺前行的勇气和前所未有的责任。宋帝都临安府爱国人士:吴俊振,与用时光机穿越过来的现代大学生:马维,两人一起被龙卷风漩涡黑洞带着,穿越到了明崇祯十六年公元1643年兴都留守司显陵卫境内,在机缘巧合之下他们俩主动应征入伍参军,从此开启一段帮助大明帝国收复失地的旅程,本文群号799968110穿越到历史严重断层的平行世界,韩休发现这里有档名为《前世今生》的节目,登上节目,就可以帮助选手回忆起前世记忆。 当韩休登上节目后,观众们惊骇的发现,他轮回九世皆为英烈! 第一世蜀汉武侯诸葛亮:功盖三分国,名成八阵图! 第二世抗金名将岳武穆:靖康耻,犹未雪;臣子恨,何时灭! 第三世铁骨铮铮文天祥:人生自古谁不死?留取丹心照汗青! …… 第九世炎帝神农:安知尝试者,百死百生来! 当前世曝光,全网泪崩!
逆仙成魔传 剑神九幽 混沌剑神 灾厄降临:我能召唤万界 人生模拟:开局被邪教绑架 穿越之我在西游卖军火 十大动漫名场面:开局夜凯 网游之VR竞技 我放弃高考去了异界 一首孤勇者,引爆乐坛 云翎说 神物之镜 一刀秒了魔神,那不是青草怪吗? 巨变的世界 降僵除鬼记 极乐神官 废柴的异世界升级之路 我的系统被世界截胡了 我不做老千好多年 龙凰乱世 党十七大代表大会邮票 癸巳年 邮票 万隆会议邮票 原版邮票对比再版 韩日世界杯邮票 一套十二生肖邮票价格 万隆会议邮票 2012邮票发行量 青花瓷 邮票 1994年的邮票价格 2010中国邮票 2010中国邮票 编年信销邮票 癸巳年 邮票 中国人民共和国第六届运动会邮票 文革信销邮票价格 中国共产党成立90周年邮票 党十七大代表大会邮票 1985熊猫邮票价格 2008邮票目录 韩日世界杯邮票 2008邮票目录 文革信销邮票价格 95年邮票年册 党十七大代表大会邮票 t103邮票价格 er中国花灯鸡邮票 原版邮票对比再版 文革信销邮票价格 j136邮票价格 2010中国邮票 1985熊猫邮票价格 万隆会议邮票 2001邮票年册价格 癸巳年 邮票 中国共产党成立90周年邮票 万隆会议邮票 孙中山诞生一百二十周年邮票 t103邮票价格 上海民居20分邮票 中国共产党成立90周年邮票 青花瓷 邮票 1994年的邮票价格 中国人民共和国第六届运动会邮票 2014-8邮票 1985熊猫邮票价格 孙中山邮票价格 中国共产党成立90周年邮票 t103邮票价格 清明上河图小全张邮票 亚星官网 亚星游戏官网 亚星官网 亚星官网 亚星游戏官网 携酒上吟亭 大唐妖魔录之扫把星转世 废材极品纨绔 操刀者 法元神 欧博官网 亚星官网 万利游戏官网 欧博官网 澳门葡京游戏官网 世界读书日邮票价格 青花瓷 邮票 上海民居20分邮票 癸巳年 邮票 孙中山邮票价格 一套十二生肖邮票价格 编年信销邮票 韩日世界杯邮票 党十七大代表大会邮票 95年邮票年册 孙中山诞生一百二十周年邮票 文革信销邮票价格 上海民居20分邮票 1985熊猫邮票价格 2012邮票发行量 中国共产党成立90周年邮票 世界读书日邮票价格 党十七大代表大会邮票 2008邮票目录 中国人民共和国第六届运动会邮票 中国人民共和国第六届运动会邮票 中国共产党成立90周年邮票 中国共产党成立90周年邮票 2001邮票年册价格 韩日世界杯邮票 95年邮票年册 孙中山诞生一百二十周年邮票 北京奥运2008小型张邮票价格 2001邮票年册价格 2010中国邮票