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
手机信用卡还款信用卡异地消费扣费用吗平安燃气信用卡福建泉州特大信用卡套现诈骗绍兴广发信用卡优惠手机信用卡还款信用卡网络预借现金平安燃气信用卡交通银行信用卡分期降额吗亚马逊信用卡有效期不正确信用卡预授权 漏洞平安燃气信用卡网上帮办理高额度信用卡是骗局吗信用卡预授权 漏洞交通银行信用卡提现2000手续费亚马逊信用卡有效期不正确信用卡流水为何不能开绍兴广发信用卡绍兴广发信用卡优惠平安银行信用卡绑定是不是信用卡忘记还了都是黑名单绍兴广发信用卡交通银行信用卡分期降额吗平安信用卡申请回复短信天津工商银行信用卡优惠平安信用卡怎么登陆app天津工商银行信用卡优惠中信银行信用卡 麦当劳 闪付平安银行信用卡绑定天津银行信用卡怎么样在艺校之中的人情世故作者:秋七幸 作品:立校高中 简介:许白和秦严在同一所高中而且心俩还是同桌(兼邻居)。后来他俩考上了同-所学校(清华),许白选择了土木工程系,而秦严则选了济经系。毕业后许白和秦严俩人过上了没差没涩的生活……牛头马面勾错魂,错把一名学霸带下了阴曹地府,最后将其送到明朝,他的明朝之旅就在这里开始..........全球异变,每个人都有属于自己的武魂,除了宁凡。 “废掉武魂跟我学修仙吧,修仙更有前途。”宁凡真诚的看着众人。 同学:“老师,宁凡疯了!送医院吧。” 爸爸:“我的好大儿,爹不嫌弃你没武魂,但是你别疯啊!” 陌生人:“喂?精神病院吗?你家病人跑出来了,赶紧来接回去。” 狗:“汪汪汪~”在工地干了3年粉刷匠的李峰,在一次下班的途中,意外获得了一个号称超级暴发户的系统,从此开启了他每天因为花钱而苦恼的生活……………他是江南水乡的英雄之子,定乱安民,勤勉治国,文定寰宇的元嘉二十七年治世终是为那片收复中原之志;他是鲜卑草原的马上王者,踏破八荒,重道抑佛,南征北战的悍马骑兵只为饮马长江的一统之威,他们是历史长河中注定的命中宿敌,也是各自人生对立纠缠三十年的一场命运羁绊,走进这段尘封的历史,南北对立的历史格局下,且看这波澜壮阔的英雄时代!穿越大明 唐鼎本想做个游手好闲的败家子 奈何摊上了个败家爹 开局败光家产,欠债十万两,被诬造反 家里还有三个美貌娇妻要养活 唐鼎无奈支棱起来 开启亲爹养成计划。 陈羽本是一名国家击剑运动员,参赛无数,荣誉无数,奖杯一面墙都摆不下。却在一次比赛中,面罩意外脱落,对手剑尖直指右眼,刹那间,天昏地暗,当他再次睁开眼,已是开元年间…一户人家二百年的风风雨雨 光明下的黑暗肆意妄为,黑暗中留有一丝光烛。 疯狂的报复,猎杀者潜行,猎物未必是猎物!
洪荒:我,后羿绝不射日 大宋崛起 幻空残梦集 我是孙笑川 梦回1998 狂浪至尊 重生之龙吟凤鸣 乱灵纪 未知战舰 末代变异的世界 我在王者捡技能碎片 走进修仙之相信科学 吟剑逍遥行 请别对鬼下手 鬼蜮:丑恶的人心 大学的江湖 北境之地 重生:我天后老公的身份差点曝光了 共分天下 万族之劫:我觉醒了神相 已有交行信用卡 北大中银信用卡 被拒 夫妻婚姻存续期间信用卡借款不还 绍兴广发信用卡优惠 信用卡异地消费扣费用吗 中信银行信用卡 麦当劳 闪付 夫妻婚姻存续期间信用卡借款不还 深圳申请招商信用卡 平安信用卡怎么登陆app 网上帮办理高额度信用卡是骗局吗 西工代还信用卡的在哪 西工代还信用卡的在哪 浦发东方航空信用卡 北大中银信用卡 被拒 手机信用卡还款 绍兴广发信用卡优惠 还信用卡有集分吗 已有交行信用卡 怎么修改信用卡网上支付限额 平安燃气信用卡 北大中银信用卡 被拒 平安燃气信用卡 怎么修改信用卡网上支付限额 绍兴广发信用卡 亚马逊信用卡有效期不正确 浦发东方航空信用卡 已有交行信用卡 怎么修改信用卡网上支付限额 怎么修改信用卡网上支付限额 平安信用卡怎么登陆app 绍兴广发信用卡优惠 美国信用卡市场份额 福建泉州特大信用卡套现诈骗 手机信用卡还款 平安信用卡申请回复短信 天津工商银行信用卡优惠 福建泉州特大信用卡套现诈骗 夫妻婚姻存续期间信用卡借款不还 平安信用卡申请回复短信 交通银行信用卡提现2000手续费 天津工商银行信用卡优惠 深圳申请招商信用卡 平安银行信用卡绑定 还信用卡有集分吗 信用卡预授权 漏洞 美国信用卡市场份额 西工代还信用卡的在哪 天津工商银行信用卡优惠 浦发东方航空信用卡 信用卡流水为何不能开 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 凰烬传 冥案秘闻 神州滴滴 黑暗序列 碧蓝航线之昨日曙光 澳门葡京游戏官网 葡京官网 AG真人 澳门葡京游戏官网 欧博游戏官网 浦发东方航空信用卡 天津银行信用卡怎么样 天津银行信用卡怎么样 手机信用卡还款 平安燃气信用卡 平安信用卡申请回复短信 平安银行信用卡绑定 交通银行信用卡提现2000手续费 天津工商银行信用卡优惠 北大中银信用卡 被拒 是不是信用卡忘记还了都是黑名单 平安信用卡申请回复短信 信用卡流水为何不能开 信用卡异地消费扣费用吗 网上帮办理高额度信用卡是骗局吗 浦发东方航空信用卡 交通银行信用卡分期降额吗 绍兴广发信用卡优惠 天津工商银行信用卡优惠 信用卡 赫兹租车 手机信用卡还款 中信银行信用卡 麦当劳 闪付 浦发东方航空信用卡 已有交行信用卡 福建泉州特大信用卡套现诈骗 美国信用卡市场份额 交通银行信用卡分期降额吗 中信银行信用卡 麦当劳 闪付 信用卡流水为何不能开 怎么修改信用卡网上支付限额