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
信用卡还款多久还一次吗信用卡黑了什么意思是什么意思信用卡好批的银行信用卡号码给别人吗信用卡号码可以怎么填信用卡还款多久还一次吗信用卡和手机银行营销信用卡好批的银行信用卡黑户怎么车贷信用卡号码是几位数字是什么意思啊信用卡号码是几位数字信用卡好批的银行信用卡号码是什么情况信用卡号码是几位数字信用卡号码给别人信用卡号码是几位数字是什么意思啊信用卡号码给别人信用卡黑了什么意思是什么意思信用卡黑了什么意思是什么意思信用卡和手机银行营销信用卡号码是几位数字信用卡黑了什么意思是什么意思信用卡号码可以怎么填信用卡号码是什么情况信用卡黑了什么意思是什么信用卡号码是几位数字是什么意思啊信用卡黑了什么意思啊信用卡号码是什么情况信用卡和手机银行营销信用卡还款低于最低还款记录我在国企无聊的摸鱼生活 这是一个灵师横行的世界,鬼怪只能在夹缝的挣扎。而主角莫北开局身为一只实力低微的游魂,如何在被各路灵师追着砍中求生,并在危机四伏的神秘世界成为一代鬼中至尊。九五后小县城协理员高煌在一次拍摄风景时偶尔入梦,结果在梦里获得了一座古老的神庙。通过这座神庙,高煌每一次在梦里都能垂钓上来不同的改变他命运的东西。那么,高煌会通过这座神庙,能让他的生活有什么变化? 而这座神庙的背后,又隐藏了什么故事? 请打开这本书,让我们踏上一段不同于他人的美好旅程!穿越到了林正英的僵尸世界, 开局, 就抽中了满级金光咒。 满级金光咒强悍无比,外可化万千剑气斩鬼杀神,内可铸钢筋铁骨万法不侵。 神级抽奖系统,包罗诸天万物。 “叮!恭喜您抽中神技——风后奇门!” “叮!恭喜您抽中法宝——太乙拂尘!” “叮!恭喜您抽中传承——千年修为!” 九叔:没想到我苦练了几十年的道术,居然还不如你一日苦修。 任婷婷:林大哥,你能教我画符咒吗?特种兵赵阳一觉醒来却发现自己竟然魂穿三国时代,并且获得了无双帝皇系统。他从此开始收名将,纳美人,灭刘备,退孙权,拒曹操煌煌一世。曹操:“我曹氏子弟不如子炎分毫。”刘备:“谁能帮我除了赵子炎,我封他为王。”孙权:“赵子炎是上天派来惩罚我的吗?”赵阳:“我还没发力,你们全倒下了,还让我怎么玩啊?”最后问鼎江山一统天下。赵阳看着眼前的皇座,心中无限感慨:“我本低调,但实力不允许,奈何奈何~~”黑与白的浪潮中,不知何人在低语……我想挣脱前往那星空的彼端,于暗羽中刻下文明的墓志铭。冥冥有间,止水湔峰。 峰主何名,别号曰玄。 玄之又玄,众妙之门。 门中大千,笔下风闻。 欢迎来到某玄的短篇故事集。当时代的马车要碾碎他喉咙时,他终于发出了反抗的吼声,开始与世俗争斗,与丑恶的人心争斗,与所有压迫者争斗。 他要解放思想,解开枷锁,揭开藏在最深处的阴暗。穿越到修仙世界,希望能活下去。神魔的游戏,养蛊人类,是举刀拿剑逆战万族,还是低眉俯首甘为奴仆,普通人的野望,你我是否都幻想过打破秩序,生与死,血与泪,离别与重逢,种种的选择,这是一部笑中含泪的作品,且看普通人如何末世中挣求活,选择自己的人生。
魔蛋传说之拳王大赛 末世觉醒之传奇人生 答定你,请配合 大道万千,我踏仙巅! 末日游戏主播 吉天记 仙戮万界 小僧无花 阿达卡之令 极光会的自我修养 十亿年生人生 三国,历史名将大乱斗 书圣门 小农村的离奇故事 满级天赋异界打工 人间地狱十几载 全能禁区之王 凤凰涅槃之龙啸南国 满级悟性的我只是个渣渣 大巫教主 信用卡很小一张 信用卡号码是几位数字是什么情况 信用卡核发后被拒 信用卡号码可以怎么填 信用卡黑了什么意思是什么意思 信用卡花呗还款会怎么样 信用卡核发后被拒 信用卡号码是什么卡 信用卡花呗还款 信用卡号码是什么情况 信用卡黑户如何 信用卡黑户如何 信用卡还款超出限额 信用卡号码是几位数字是什么情况 信用卡还款多久还一次吗 信用卡号码可以怎么填 信用卡核发后被拒绝 信用卡很小一张 信用卡黑了什么意思是什么 信用卡好批的银行 信用卡号码是几位数字是什么情况 信用卡好批的银行 信用卡黑了什么意思是什么 信用卡号码是几位数 信用卡号码是几位数字是什么意思啊 信用卡还款超出限额 信用卡很小一张 信用卡黑了什么意思是什么 信用卡黑了什么意思是什么 信用卡花呗还款 信用卡号码可以怎么填 信用卡号码是几位数字是什么 信用卡号码给别人吗 信用卡还款多久还一次吗 信用卡还不上算诈骗吗 信用卡号码给别人用吗 信用卡号码给别人吗 信用卡核发后被拒 信用卡还不上算诈骗吗 信用卡号码给别人 信用卡号码给别人用吗 信用卡号码是什么卡 信用卡还款超出限额怎么办 信用卡核发后被拒绝 信用卡号码是几位数字 信用卡号码是几位数字是什么 信用卡黑户如何 信用卡号码给别人用吗 信用卡还款超出限额 信用卡和银联卡预授权 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 界桥 玄幻:我的灵气能化万物 灵魂公司 一代妖相 大唐,开局李二是我爹? 亚星管理平台 葡京官网 AG真人 亚星管理平台 万利官网 信用卡还款超出限额怎么办 信用卡核发后被拒 信用卡黑户怎么车贷 信用卡还款超出限额 信用卡黑了什么意思啊 信用卡核发后被拒绝 信用卡黑了什么意思是什么意思 信用卡号码是几位数字是什么情况 信用卡号码给别人吗 信用卡号码是几位数字是什么意思啊 信用卡花呗还款 信用卡黑了什么意思是什么 信用卡花呗还款会怎么样 信用卡号码给别人吗 信用卡还款超出限额 信用卡花呗还款会怎么样 信用卡核发后被拒 信用卡还不上算诈骗吗 信用卡还款多久还一次吗 信用卡号码是几位数字 信用卡还款多久还一次吗 信用卡还款超出限额 信用卡号码给别人 信用卡黑户怎么车贷 信用卡黑了什么意思是什么意思 信用卡黑了什么意思啊 信用卡号码可以怎么填 信用卡好批的银行 信用卡号码可以怎么填 信用卡和手机银行营销