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
在什么银行可以贷款在读大学生贷款麻烦嘛在什么银行可以贷款招行小额贷款怎么还招行小额贷款怎么还款在平台贷款能贷几次月流水5万可以贷款多少钱在什么银行可以贷款玉田私人贷款找私人贷款利息是多少钱招行小额贷款怎么还款在平安普惠贷款不还找私人贷款利息是多少钱招行小额贷款怎么还款在平台贷款能贷几次招行信用卡三个月贷款有必要贷款买二套房招行小额贷款怎么还云南曲靖个人贷款在平安贷款不还逾期还款公积金贷款招行小额贷款怎么还逾期还款 公积金贷款吗在建行怎么贷款买车云南曲靖贷款怎么样在读大学生贷款麻烦嘛云南曲靖贷款怎么样在建行怎么贷款在平安贷款不还找投资理财贷款【老婆做封面,快乐永无限!】 陈阎在末日寻找病毒血清,在关键时刻惨遭女友背叛,濒死之际意外觉醒了死亡系统,转世重生到年前。陈阎:什么死亡才能变强?要知道那是一个非常不错的秋日午后,当和煦的阳光洒在我的身上,微凉微风吹拂在我的脸上,将今日好好摆弄的清洗的刘海微微抚起,而就在同时,一位长得颇在我萌点上女孩迎面走来,正当我感叹着世间的美好,然后……我转生为了龙? 出生可以渺小,但是梦想不能小,一个人可以有缺点,但是不能不进取,可以开始很弱,但是不能一直是弱者,王侯将相宁有种乎,任何的强大都是从弱小一步一步克服困境,磨练成长起来的。 且看一个山野乡村的小孩,如何克服种种条件的限制,一步一步克服困境,磨掉缺陷,在重重困境中突破极限,迈向更高的成就。 这里有成长突破的秘诀,有逆境重生的锻造,有慷慨激昂的誓言,有兄弟情深的情谊,有战天斗地的决心,也有儿女情长的温情,楚洪不只是一个角色,也是一生活在活生生的世界,经历种种生活处境的人。 在这里没有一步登天的机缘,没有重启人生的生而知之,也没有随身携带的金手指,有的只是一步一个脚印的成长突破轨迹,一部走出自我人生的奋斗史,天行渐,生命不息,战斗不止。呼吸还在,成长不止。这是一个修炼玄能为主的世界,玄能就是这个世界的主旋律。 没有玄能的人就会生活在这个大陆的最底层。 等级制度:玄徒、玄者、玄士、玄师、大玄师、玄主、玄宗、玄王、玄皇、玄尊、 功法级别:日月星尘,每阶段九品,一品最次九品至高 玄器阶位:天地玄黄,每位分九阶,一阶最低九阶最高 公元前275年,穰侯魏冉率秦军进逼大梁,他不知道,大梁之中一个残病之人将会改变他的命运。公元前270年,一个叫张禄的神秘人物成为秦王客卿。公元前266年,张禄成为秦相,魏冉被逐出咸阳。公元前260年,秦赵战于长平,赵军被坑45万。公元前259年,秦军包围赵都邯郸,未来的始皇帝赵政生于围城之中。公元前256年,秦灭周。冬月,未来的汉高祖刘邦生于沛。公元前255年,张禄连同他的三人组一齐被杀。 新人报道,请多指教。或许有一天,当你踮起脚尖的时候,你会发现世界都变得广阔了一些。神与仙的比拼,妖与魔的碰撞,机器与人的厮杀,这里有最神奇的大陆,有最热血的青年,有最精彩的战斗, 让云岚带你开启星空的纪元之旅。魂穿异世,成为女帝的灵宠流云豹,一人之下万万人之上,区区系统还想安排我,流云表示怎么可能? 每天吃了睡,睡了吃,系统安排的任务一拖再拖,女帝随手就是仙阶丹药,怎么可能看得上天阶的任务奖励。 对此系统轻蔑一笑,反手安排八代长老率领十五个马仔手持三十米砍刀从南天门一路追杀到蓬莱东路。 流云欲哭无泪。 系统爸爸我错了,我再也不敢了,求放过,嘤嘤嘤……上古圣体天骄为弥补遗憾去除心魔步入轮回,不料轮回后毫无修道天资,不甘命运,为家族复仇,终踏上属于自己的道。 后重拾因果命运,阻止界外生灵侵犯六界,拯救六界生灵,立下无主之约,成无主之界。
荒事 全球御兽:开局觉醒SSS级天赋 笑吞江湖 末日求生之现实 万域剑帝 另类圣经 欺世魔术 看事 朝泗镇怪谈 茗刀 猿王 灵祎事件 校园?社会! 起始黎明 疆域之门 我名:恒生 穿越时空的医术 黎明万相 请 神 圣龙武神! 在建行怎么贷款 招行信用卡三个月贷款吗 逾期贷款的展期 招行小额贷款怎么还款 在建行怎么贷款 岳阳有私人贷款吗 逾期还款 公积金贷款吗 找投资理财贷款 在建行怎么贷款买车 有保险能贷款多少钱啊 玉田私人贷款 逾期还款公积金贷款 在平安贷款不还会怎么样 招行信用卡三个月贷款吗 在平台贷款能贷几次 招行小额贷款怎么还款 逾期还款 公积金贷款吗 在建行怎么贷款买车 在读大学生贷款步骤 在什么银行可以贷款 招行信用卡三个月贷款吗 云南曲靖贷款怎么样 在读大学生贷款麻烦嘛 招行企业信用贷款 找私人贷款利息是多少钱 在平安贷款不还会怎么样 在建行怎么贷款买车 在读大学生贷款麻烦嘛 在读大学生贷款步骤 在建行怎么贷款买车 招行小额贷款怎么还款 招行信用卡三个月贷款吗 云南曲靖个人贷款 在平台贷款能贷几次 在平安贷款不还 招行小额贷款怎么还款 云南曲靖个人贷款 逾期贷款的展期 在平安贷款不还会怎么样 云南曲靖贷款怎么样 招行小额贷款怎么还 邮政小额贷款业务流程 在平安普惠贷款不还 逾期还款公积金贷款 招行企业信用贷款 招行信用卡三个月贷款吗 逾期还款公积金贷款 招行小额贷款怎么还 在平安贷款不还会怎么样 月流水5万可以贷款多少钱 亚星官网 亚星游戏官网 亚星游戏官网 亚星官网 亚星官网 斗气的九大世界 小丑笑抽 丧尸末世:菜狗也怕死 元宇宙:我从现实挑演员 九劫真神齐飞鸿 亚星管理平台 万利游戏官网 万利官网 亚星游戏官网 澳门葡京官网 在建行怎么贷款 招行小额贷款怎么还 找投资理财贷款 在什么银行可以贷款 逾期还款 公积金贷款吗 招行信用卡三个月贷款 云南曲靖贷款怎么样 在建行怎么贷款买车 逾期还款公积金贷款 玉田私人贷款 月流水5万可以贷款多少钱 逾期贷款的展期 邮政小额贷款业务流程 在读大学生贷款麻烦嘛 在平安贷款不还会怎么样 招行信用卡三个月贷款 有必要贷款买二套房 招行小额贷款怎么还 找私人贷款利息是多少钱 在什么银行可以贷款 逾期贷款的展期 招行企业信用贷款 在建行怎么贷款 在建行怎么贷款 找私人贷款利息是多少钱 找私人贷款利息是多少钱 招行小额贷款怎么还款方式 月流水5万可以贷款多少钱 找投资理财贷款 在读大学生贷款麻烦嘛