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
宝宝得了疱疹哭闹不止宝宝多大多大吃南瓜宝宝得了疱疹哭闹不止16个月宝宝大头16个月的宝宝高烧不退宝宝单核细胞百分率18宝宝3岁手脱皮15天宝宝鼻子眼睛黄宝宝得了咽颊炎传染吗1岁宝宝拉肚子绿色拉稀宝宝额头一片红红的宝宝得了疱疹哭闹不止哺乳期吃凉宝宝拉肚子宝宝吃清热下火的药物15天宝宝鼻子眼睛黄1岁宝宝拉肚子绿色拉稀宝宝40度高烧拉肚子宝宝吃扑尔敏几天有效果宝宝吃扑尔敏几天有效果宝宝大便有像米汤东西宝宝肚皮热是怎么回事宝宝吃扑尔敏几天有效果宝宝得了咽颊炎传染吗宝宝打预防针不舒服吗16个月的宝宝高烧不退宝宝出牙会淋巴结肿大16个月宝宝大头宝宝打预防针不舒服吗宝宝大便有像米汤东西哺乳期吃凉宝宝拉肚子一位出生平凡的少年,经历了读书,实习,工作而面对现实中的酸甜苦辣,失去爱他的,保护他的人会是怎样的处境。飞星坠世,山庄尽屠,一老一少骑着大青马离去,十余年后,小子出成,老人带着他重回少林,掀开五十年前的江湖风雨,故事之后,小子又该何去何从? 江湖一统,究竟是壮举,还是阴谋? 背后之人,到底是英雄,还是奸贼? 佛门四蒂,上浩传人,华山君子剑,川蜀姥姥山,又将卷起怎样的江湖故事?天生绝品丹脉却一夜散尽,从家族明珠一朝变成弃子,成为一名小小的种药工,依旧无法置身事外。 遂跃于凡尘,种药炼神丹,炼体为炉鼎,活脱脱将自己炼成了绝世的神丹。 写的不好 当强大的外族入侵时,作为一名普通老百姓你会怎么选择?是农具当武器站着死,还是归顺他们苟且生?当外族入侵时,作为一名高高在上的九五至尊,你会怎么选择?是割地赔款最终成为一名国破家亡的亡国奴,还是振臂高呼带领大家抵御外族将他们赶出国门最终把他们消灭掉啦? 作为一名普通老百姓,当外族入侵时,农具必是武器,站着死。作为一名天子?你做过天子吗? “ 没有” 那就让我们随着20世纪的小白方小乐到大周王朝看看,作为天子的他会怎么抉择,是站着死还是跪着生。孔铮能够在英雄本色香江世界和蓝星之间穿越,嘴贱惹祸,被逼进了娱乐圈,他是小商人、是莽汉、是侠骨柔情、是钢铁直男......一个无知小人物逆袭的故事。少年从小厄运缠身,身边人一个个离去,阴差阳错来到异世大陆,被人救治,却给救人者带来不幸,自己也再次涉险,从此开始流浪,在流浪中修炼,在流浪中成长,最终......这是一部以电影剧本为主要创作构思基础的作品,故参考了电影剧本的格式进行写作,每一个段落就是一个电影场景画面和镜头展示,暂且称这部作品为非专业的“纸电影”吧。 故事讲述一位忠国少年文润华在米国夏为宜读中学时意外发现了一颗纯度达90%的金子流星,这颗流星会在十年后到达地球。之后,在对太平洋海底地质的科考研究中,文润华发现了太平洋地壳板块的不稳定性与存在裂纹的隐患。不久后,月球满月之际,在月球引力、金子流星磁场、太阳风暴的共同联动影响作用下,地球内部的地幔的能量平衡被打破,太平洋东南部海底的板块突然崩裂,产生大地震,同时掀起了巨浪,环太平洋很多地方的火山爆发,在水与火的双重袭击下,很多地区受灾严重,全球各国参与救灾,而忠国扮演了最重要的角色…… 如果继续这样下去的话,自己早晚有一天会彻底放弃的。因为他已经不再属于部队,也无法再上阵杀敌了,这是一个残酷的现实。现代都市和平生活并未持续多久。当平行的世界被人们挖掘到信息,位面重叠,世界重启。这里变成了修行者的世界。无尽的尸海,广阔的荒漠,万族林立,百家争霸,无情的杀戮将一切虚幻斩断,而何处才是人类栖息之地?
众神武纪 现实中回首梦幻 末世:我的避难所无限升级 人生大梦,梦世轮回 无限穿梭世界的我掌控一切 超凡双界 九则人世间 南疆修仙传 超级天才保镖 医商巨擘 终末残响 穿越秦朝之始皇是我兄弟 青山下的田园 剑道崛起 极道人神 小农村的离奇故事 全球第一人 浴血路,通天道 我和我的兄弟征战万界 大秦:小子,不装了,我就是祖龙! 15个月中午宝宝吃什么最好 宝宝耳道被黄痂堵住了 宝宝40度高烧拉肚子 16个月的宝宝高烧不退 15个月中午宝宝吃什么最好 宝宝打完预防针用摸了 宝宝8个月371算发烧吗 1岁多宝宝缺钙锌 宝宝出牙会淋巴结肿大 哺乳期吃凉宝宝拉肚子 宝宝得了咽颊炎传染吗 18个月的宝宝有耳屎怎么办 宝宝大便次数增多发热 宝宝耳道被黄痂堵住了 宝宝单核细胞百分率18 16个月的宝宝高烧不退 宝宝8个月371算发烧吗 宝宝出牙会淋巴结肿大 宝宝肚皮热是怎么回事 宝宝得了疱疹哭闹不止 宝宝耳道被黄痂堵住了 15天宝宝鼻子眼睛黄 宝宝多大多大吃南瓜 宝宝吃清热下火的药物 1岁宝宝拉肚子绿色拉稀 宝宝大便次数增多发热 宝宝出牙会淋巴结肿大 宝宝多大多大吃南瓜 宝宝肚皮热是怎么回事 宝宝出牙会淋巴结肿大 16个月的宝宝高烧不退 宝宝耳道被黄痂堵住了 15月宝宝缺钙吃什么 宝宝单核细胞百分率18 宝宝打预防针不舒服吗 16个月的宝宝高烧不退 15月宝宝缺钙吃什么 宝宝40度高烧拉肚子 宝宝大便次数增多发热 15天宝宝鼻子眼睛黄 16个月宝宝大头 1岁三个月宝宝流鼻血 宝宝大一点容易断奶吗 18个月的宝宝有耳屎怎么办 宝宝吃清热下火的药物 宝宝耳道被黄痂堵住了 18个月的宝宝有耳屎怎么办 16个月宝宝大头 宝宝大便次数增多发热 宝宝3岁手脱皮 亚星官网 亚星官网 亚星官网 亚星官网 亚星游戏官网 洪荒:家兄冥河,我稳健成圣! Minecraft:巅峰之路 神游记之道破虚空 天命司 灿烂星河之上古星门 AG真人 欧博官网 亚星管理平台 AG真人 百家乐官网 宝宝大一点容易断奶吗 宝宝得了咽颊炎传染吗 16个月的宝宝高烧不退 宝宝打预防针不舒服吗 1岁三个月宝宝流鼻血 1岁三个月宝宝流鼻血 宝宝大便有像米汤东西 宝宝大一点容易断奶吗 宝宝打完预防针用摸了 16个月宝宝大头 宝宝单核细胞百分率18 1岁宝宝拉肚子绿色拉稀 宝宝3岁手脱皮 宝宝打预防针不舒服吗 15天宝宝鼻子眼睛黄 宝宝3个月头老偏着 宝宝大便有像米汤东西 宝宝得了咽颊炎传染吗 宝宝打预防针不舒服吗 宝宝打完预防针用摸了 1岁多宝宝缺钙锌 1岁多宝宝缺钙锌 宝宝大便有像米汤东西 宝宝大便有像米汤东西 宝宝出牙会淋巴结肿大 宝宝打完预防针用摸了 宝宝大一点容易断奶吗 15天宝宝鼻子眼睛黄 宝宝吃清热下火的药物 18个月的宝宝有耳屎怎么办