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
长沙10月1日到8日天气预报康巴什未来十五天天气长沙10月天气预报30天鄂尔多斯康巴什新区天气国庆后天气长沙10月1日到8日天气预报土耳其伊斯坦布尔11月份天气长沙10月天气预报30天康巴什的天气山东济南台天气预报2016年3月份长沙天气长沙10月天气预报30天天气yt一周2016年3月份长沙天气长沙3月天气记录山东济南台天气预报卡尔加里4月天气湖南长沙这两天天气怎么样湖南长沙这两天天气怎么样长沙10月14日 天气预报康巴什实时天气预报湖南长沙这两天天气怎么样康巴什的天气长沙市最近一周天气预报鄂尔多斯市未来15天天气预报内蒙古鄂尔多斯市天气预报鄂尔多斯市未来15天天气预报长沙市最近一周天气预报长沙10月14日 天气预报天气yt一周陈彬为了完成父母夙愿,考入警校的刑侦专业。 可进入警局实习的前一天晚开始噩梦。 即将发生的凶案细节,全部都会清晰显现于梦中。 跟踪案件,抽丝剥茧,层层拨开,最后竟是一个巨大的阴谋。你怎么什么都懂? 我看着像懂吗? 万能公式,果然是万能的 风水相师,山精鬼怪 我有系统,欲证长生道从春秋到汉朝,各路英雄辈出,书写自己的传奇。人类的末世降临,于乱世之中形成三雄割据!丧尸帝国,兽人部落,人类文明,摇摇欲坠的是星辰还是明灭飘忽的未来……只因一颗黑色灵珠,只因他能压制玄龙大陆,以武为尊。 少年叶平安得到败天武帝的至尊天眼,从一个卑微的蝼蚁,成为至高无上的绝世武帝! 一路上白骨累累,红颜多娇路飘摇,无敌路上太寂寥!本来是一个小小客服被神选到了小说世界,没想到系统来晚了害我白等了十五年 没想到吧系统重启直接重新开始,黑暗森林我带着系统回来了!当吴狄秉着爱国,诚信,敬业,友善的优良品质,混进金庸先生笔下的武侠世界当中,成为一名武当道士时 面对上辈子无数个夜晚在床上幻想过的武功秘籍,看见那一位位老爷子笔下倾城倾国的女猪脚们,吴狄表示 别无选择,唯有制霸江湖!秦凡为救老婆,不得已暴露自身能看到宝物气息的能力,不断捡漏,只要是宝物,在秦凡的眼中都无所遁形,因此引起各方势力的注意,破真伪,看人心,鉴宝捡漏,玩转人生……越识州本是尊贵的曜日皇室大皇子,前十七年寻遍世间修行之法,却被告知丹田空洞,修行不能。万念俱灰之际,天下第一的渡劫期大能却要收他为徒、传他修行之法。 前路阴谋算尽,身后暗箭齐鸣,越识州一路与虎谋皮,步步为营。待终于行至最高处,才发现助他成神的修行之法是师父编造哄他的,养育他多年的父皇是弑母仇人,到最后,连自己的亲生父亲,竟也是夺他神力的魔界之首! 行至最高处,越识州才悟到,何以为神?唯有正心证道。
荒诞世界:挣扎 散曲 血宴苍穹 极之竞技 万道神王 艾斯兰德 轨迹留下的痕迹 肉蛋宇狗蛋 弑人悲 系统大战老爷爷 重生之天元剑神 一壶好酒 微醺 都市万古医尊 青春期间的一些故事 巨龙绝境 今宵杯中映明月 重生之我是隐士高人 缤纷剑 破镜湮生 大衍噬元诀 明后天杭州天气 yt天气预报 卡尔加里4月天气 国庆后天气 明后天杭州天气 郴州2017年3月份天气 卡尔加里4月天气 山东天气三天预拔 内蒙古鄂尔多斯市天气预报 十月1日天气长沙 康巴什10月天气预报 康巴什10月天气预报 长治县5月份天气 yt天气预报 长沙10月1日到8日天气预报 国庆后天气 卡尔加里全年天气预报 内蒙古鄂尔多斯市天气预报 康巴什天气15 长沙10月天气预报30天 yt天气预报 长沙3月天气记录 康巴什未来十五天天气 2016年3月份长沙天气 山东济南台天气预报 长治县5月份天气 内蒙古鄂尔多斯市天气预报 康巴什未来十五天天气 康巴什天气15 内蒙古鄂尔多斯市天气预报 国庆后天气 2017年三月份长沙天气 鄂尔多斯康巴什新区天气 长沙10月1日到8日天气预报 长沙市最近一周天气预报 国庆后天气 鄂尔多斯康巴什新区天气 卡尔加里4月天气 长治县5月份天气 长沙3月天气记录 鄂尔多斯市未来15天天气预报 十月1日天气长沙 长沙10月14日天气 卡尔加里全年天气预报 2016年3月份长沙天气 2017年三月份长沙天气 康巴什10月天气预报 鄂尔多斯市未来15天天气预报 长治县5月份天气 土耳其伊斯坦布尔11月份天气 亚星官网 亚星官网 亚星官网 亚星官网 亚星游戏官网 金戈铁马画江山 文明继承者 西南侠客 网恋女友不是人 日出时的乐队 欧博官网 亚星管理平台 澳门葡京游戏官网 欧博官网 亚星游戏官网 2017年三月份长沙天气 湖南长沙这两天天气怎么样 康巴什的天气 2016年3月份长沙天气 山东济南台天气预报 康巴什10月天气预报 山东天气三天预拔 长沙10月1日到8日天气预报 天气yt一周 长沙10月1日到8日天气预报 内蒙古鄂尔多斯市天气预报 长沙10月天气预报30天 土耳其伊斯坦布尔11月份天气 鄂尔多斯市未来15天天气预报 卡尔加里4月天气 内蒙古鄂尔多斯市天气预报 康巴什10月天气预报 卡尔加里4月天气 长沙10月14日天气 卡尔加里全年天气预报 康巴什实时天气预报 长沙10月14日 天气预报 康巴什天气15 山东济南台天气预报 明后天杭州天气 山东济南台天气预报 鄂尔多斯市未来15天天气预报 山东天气三天预拔 郴州2017年3月份天气 天气预报-中国气象频道