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
欧美被追捕逃亡的电影希腊色情电影有哪些电影 建筑 爱情 大学生徐老怪主导电影有那些兰辉电影的故事真的吗?欧美被追捕逃亡的电影甄子丹跟陈慧演的电影电影 建筑 爱情 大学生电影外国反译的初恋美国电影法国电影 红圈欧美被追捕逃亡的电影傲慢与偏见电影剧照2014年北京大学生电影奖电影 建筑 爱情 大学生初恋美国电影一部塞尔维亚电影迅雷第30届香港电影金像奖 迅雷下载第30届香港电影金像奖 迅雷下载兰辉 电影时长夏洛特烦恼电影花絮第30届香港电影金像奖 迅雷下载电影外国反译的武侠老电影有哪些兰辉电影的故事真的吗?香港少妇出轨电影徐老怪主导电影有那些电影百团大战很差2012年上映的电影 侠客傲慢与偏见电影剧照班上不说话的怪同学,是因为内向吗?为什么被人欺负会什么话都不说?某种事情的开端,现充女由纪慢慢对这个怪同学引起兴趣……千年等一回,前世你为我亡,这世我为你生! 少女珂玥秘密守护着“时间之刃”——能将时空伸缩、折叠及扭曲的远古神器。魔界使者姽媚奉命转世追杀夺宝。暗物质世界(异次元时空)的蜥族人创立空玄教,寻找上古神族基因,欲统天下……神秘的“觉醒者”,似乎无处不在,却让人看不见摸不着。珂玥几近绝望之际,才发现“觉醒者”竟然是……?你富可敌国?你权倾天下?在我面前都低调些。 我叫赵铁柱,普通小农民,可我既能救你的命,也能要了你的命。当一个文明到了最后阶段会发生什么?死亡还是重生,要战争还是要和平。从银河中心的搜寻者带来的究竟是一个开端还是一个结束。子文明又如何尽快赶上对弈敌人的风口。“观察者先生,我们两个世界的发展,多谢有您”(这本书我尽量在讲主线的同时,会把基本和重要信息交代下,避免人物形象和情节不够完整)谨以此致敬高三的时光2009年到2021年间,g城作为改革开放后迅速崛起的沿海城市之一,政治经济快速发展,商界奇才、慈善大家、教育大亨······齐聚在g城,由此展开一场场腥风血雨的争斗······ 生命本就脆弱,可以像尘土一样被一口气吹的烟消云散,但也可以活得无比顽强,像钢铁一般柔韧坚强。选择什么样的活法决定了人过什么样的生活,是像尘土一样毫无分量还是像钢铁一样成为国之柱石。在这个世界里,身存环境艰难,身边的亲朋好友随时都会被夺走性命,只有最坚韧的人才能活到最后。然而最终,我们都将从尘土里来,再回到尘土里去。新人一枚,请多多支持,不喜勿喷我秦飞,这辈子,有刀,有守护之人,足以。
另一个时空的秩序 我以诗词问长生 骷髅领主的成长日记 仙班册 花之谜案 数字警察 断层世界 立校高中 一只鬼眼里的世界 诸界剑尊 你是我心中的明天 我在绝地求生杀敌成神 修仙途漫漫 我的双眼看见鬼 最贼修仙者联盟 重生东汉末年之我为刘协 飞天英豪 天道眷顾 草莽也能是英雄 三族至尊 夏洛特烦恼盗版电影 电影搜索 截图 一部塞尔维亚电影迅雷 第30届香港电影金像奖 迅雷下载 夏洛特烦恼盗版电影 花旗少林 电影完整 傲慢与偏见电影2005免费 2015好看带h的电影 香港少妇出轨电影 傲慢与偏见电影剧照 电影外国反译的 成龙寻宝电影 武侠老电影有哪些 初恋美国电影 电影新冷血十三鹰 兰辉电影的故事真的吗? 傲慢与偏见电影2005免费 香港少妇出轨电影 夏洛特烦恼电影花絮 欧美被追捕逃亡的电影 电影搜索 截图 电影 建筑 爱情 大学生 希腊色情电影有哪些 2014年北京大学生电影奖 初恋美国电影 武侠老电影有哪些 香港少妇出轨电影 希腊色情电影有哪些 夏洛特烦恼电影花絮 香港少妇出轨电影 兰辉电影的故事真的吗? 电影搜索 截图 徐老怪主导电影有那些 欧美被追捕逃亡的电影 电影百团大战很差 兰辉电影的故事真的吗? 电影狭路英雄 傲慢与偏见电影2005免费 武侠老电影有哪些 电影狭路英雄 兰辉电影的故事真的吗? 写错电影名 兰辉 电影时长 成龙寻宝电影 2014年北京大学生电影奖 电影搜索 截图 电影外国反译的 徐老怪主导电影有那些 2012年上映的电影 侠客 甄子丹跟陈慧演的电影 亚星官网 亚星官网 亚星游戏官网 亚星官网 亚星官网 十洲仙纪 仙帝大道 岁月元尊 系统开机后,我变强了亿点点 循环启示录 亚星官网 欧博游戏官网 欧博官网 万利游戏官网 AG真人 花旗少林 电影完整 电影百团大战很差 欧美被追捕逃亡的电影 电影狭路英雄 法国电影 红圈 电影外国反译的 香港少妇出轨电影 青春十大电影 夏洛特烦恼电影花絮 2015好看带h的电影 电影百团大战很差 傲慢与偏见电影2005免费 电影狭路英雄 电影狭路英雄 2012年上映的电影 侠客 兰辉 电影时长 香港少妇出轨电影 电影百团大战很差 希腊色情电影有哪些 电影 建筑 爱情 大学生 2014年北京大学生电影奖 成龙寻宝电影 香港少妇出轨电影 兰辉电影的故事真的吗? 情定河州电影 初恋美国电影 电影百团大战很差 傲慢与偏见电影2005免费 电影狭路英雄 电影狭路英雄