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
老邮票收购地址中国恐龙邮票如何购买邮票50分2003-15晋祠彩塑邮票金雕邮票价格老邮票收购地址镀金邮票纪念册值钱吗邮票50分长沙哪里可以卖邮票邮票上的中国邮政字体特1-特10缩量邮票图片邮票50分怎么分辨邮票真假图片特1-特10缩量邮票图片邮票50分邮票上的中国邮政字体儿童邮票发行抗战军人邮票 国家文物金雕邮票价格邮票整版多少张特35邮票价格表抗战军人邮票 国家文物长沙哪里可以卖邮票木兰从军邮票去那卖中国建军90周年邮票82年狗年邮票4枚中国建军90周年邮票纪4邮票鉴定邮票整版多少张兜兰邮票中南亏损苍风家族被灭,偶然得到无敌传承,一路披荆斩棘,杀妖兽,斩魔头,终得无敌,复仇的过程中与最爱的人相爱相杀,虐恋缠绵,与生死兄弟......以另一个视角(陶南)面对生活的世界的巨大变化为保护女友而伤人的徐枫,入狱三年意外获得一身本领。 没想到出狱后,女友竟然要嫁给当年的仇人。 可怜这瞎眼的女人,本可一步登天,却选择坠入炼狱!一个以武为尊的世界,离奇的身世,坎坷的成长之路,隐藏的危机,正义与邪恶的较量,亲情爱情友情之间该如何抉择,看他如何谱写属于自己的风华篇章!风都一个出现了英雄的城市,在假面骑士W打败了最后一位掺杂体后风都又回归了平静。但事情并没有结束。十年后发现的一个遗迹打破了这一静。那是来自黑暗世界的力量,将人们吞噬的力量,将世界笼罩的力量,这一切会由谁来打破呢?是英雄回归?还是光明乍现?等待人们的是臣服黑暗还是奇迹的发生?生存在虚无缥缈的世界里,越来越多的域外生物不断入侵,面对着不断覆灭着的星球,由十大圣殿改造出的罪恶人类降世,年仅15岁的他将要成为这课星球的无上禁忌。离家出个走,居然遇到了一名博士。 他们之间的缘分远不止一面之缘,一些奇奇怪怪的东西随着两人的接触,渐渐跑进了他的生活。 古怪离奇的东西变成了自己的日常。 世界的本来面目被一点点揭开,能窥觑到的每一个部分都让人惊异万分且难以承受! 而这些仅仅是大千世界的九牛一毛而已! 就算知道了太多太多,需要很长时间去消化。 那这,是否又真的是世界最真实的那一面呢? 这博士,究竟又是怎样的…人呢? 他又小心翼翼的维护着怎样的秘密…? 【对世界的新认知!】 【对科技的惊发现!】 【对未来的再思考!】 【认知崩塌重新排序的宇宙狂想曲!】 上界八十八星座守护神灵再次降落人世,未来的都市美轮美奂霞光溢彩,但在这光鲜亮丽的背后是无尽的深渊与黑暗……数百年前的古老传说正预言着危机的到来。宇宙外挂哪家强,蓝星华夏找冯哲 操纵一切的超感单元、 化身超人的基因编辑、 无尽深渊的黑色盒子、 永不落幕的绝对壁垒、 拥有了这些黑科技,让你在星系间横着走! 什么灭绝帝国、寰宇企业、失落神话通通躲着你! 只有你想不到,没有他做不出的外挂! 现在马上投资入股,宇宙的命运就掌握在你我手中! 易钊意外穿越到了一个人与鬼怪生存的世界,在这里人和鬼怪对立, 而易钊却意外获得了阎王送赠的物理驱鬼系统,从此成为了这个世界的王者。
从蛇开始的进化 神医从妇科圣手开始 更新时代 乾坤阴阳图 末世之修罗火神 仗剑问道 寒门贵公子 仙异传奇 魔鬼崛起 我笑修炼是坐牢 上方 欲与罪罚 寒意剑心l 转生龙与精灵乱舞! 守我的规矩 乱劫起 和小秘一起探寻隐秘 重生之龙吟凤鸣 我自异世而来 龙穴秘闻录 82年狗年邮票4枚 邮票纪念册在哪里买 邮票版式二的发行量 金雕邮票价格 中国恐龙邮票如何购买 纪4邮票鉴定 邮票版式二的发行量 长城长卷版邮票发行量 今年发行生肖瓷邮票 怎么分辨邮票真假图片 君子兰小型张邮票价格 君子兰小型张邮票价格 木兰从军邮票去那卖 邮票纪念册在哪里买 老邮票收购地址 中国建军90周年邮票 邮票价格 中国古代书法 82年狗年邮票4枚 特48邮票价格 邮票50分 邮票纪念册在哪里买 邮票50分 特48邮票价格 抗战军人邮票 国家文物 邮票上的中国邮政字体 井冈山邮票收购价 82年狗年邮票4枚 特48邮票价格 特48邮票价格 今年发行生肖瓷邮票 金雕邮票价格 有价值邮票有哪些 2003-15晋祠彩塑邮票 老邮票收购地址 木兰从军邮票去那卖 中国建军90周年邮票 2003-15晋祠彩塑邮票 邮票版式二的发行量 木兰从军邮票去那卖 梦回童年邮票 中国建军90周年邮票 长城长卷版邮票发行量 邮票整版多少张 邮票价格 中国古代书法 特1-特10缩量邮票图片 有价值邮票有哪些 君子兰小型张邮票价格 中国建军90周年邮票 井冈山邮票收购价 儿童邮票发行 亚星官网 亚星游戏官网 亚星官网 亚星官网 亚星游戏官网 神医龙婿 重生之逐鹿中原 金灵神剑诀 假如给你一个亿 为新神的诞生献上荆棘王冠 欧博官网 亚星官网 万利游戏官网 欧博官网 澳门葡京游戏官网 中国建军90周年邮票 特1-特10缩量邮票图片 儿童邮票发行 特1-特10缩量邮票图片 金雕邮票价格 邮票上的中国邮政字体 井冈山邮票收购价 中华邮票网app 邮票整版多少张 怎么分辨邮票真假图片 邮票纪念册在哪里买 兜兰邮票中南亏损 特48邮票价格 82年狗年邮票4枚 兜兰邮票中南亏损 中国建军90周年邮票 中国恐龙邮票如何购买 纪4邮票鉴定 纪4邮票鉴定 君子兰小型张邮票价格 儿童邮票发行 邮票整版多少张 特1-特10缩量邮票图片 邮票纪念册在哪里买 有价值邮票有哪些 老邮票收购地址 长沙哪里可以卖邮票 82年狗年邮票4枚 邮票50分 2003-15晋祠彩塑邮票