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
一岁宝宝每天户外活动时间三个月宝宝晚上舔被子宝宝坐着往前趴女宝宝名字里面有“煊”字宝宝玩具哪些品牌安全放心一岁宝宝每天户外活动时间乳头太大宝宝不好吸奶宝宝坐着往前趴宝宝侯喘的偏方?8个月宝宝可以坐火车吗1岁宝宝吃鱼肝油好吗?宝宝坐着往前趴宝宝可以一直喝2段奶粉吗1岁宝宝吃鱼肝油好吗?2岁宝宝吃了芝麻油渣会怎么样8个月宝宝可以坐火车吗五个月宝宝坐飞机要买票吗宝宝爱喝汤能代替喝水吗宝宝爱喝汤能代替喝水吗一个多月的宝宝爱舔怀孕什么时候宝宝长的最快宝宝爱喝汤能代替喝水吗宝宝侯喘的偏方?宝宝吃母乳照片宝宝玩具哪些品牌安全放心9个月宝宝能吃羊肉吗一岁9宝宝手老放嘴巴为什么宝宝吃母乳照片一个多月的宝宝爱舔宝宝可以一直喝2段奶粉吗 ﹝本书抖音号∶周少爷的刀,67104207116﹞ 人在江湖身不由己。他的刀轻易不能出鞘,出鞘就得死人,杀人如同吹灯,什么时候开刀噬血?只在一念间。花季少女海外旅行离奇失踪,多年后再现身爆出惊人内幕…恐怖经历揭秘世界上不为人知的阴暗角落里,发生的一幕幕人间惨剧。...陆冲穿越到与母星似是而非的高武蓝星,觉醒武功自动修炼系统。 纳气诀三百六十五天不间断修炼,修为没有瓶颈; 开碑手知耻后勇,修炼速度翻倍,突破到大成; 金钟罩觉得自己还能抢救,自行推演成为神级武学…… 全球进化,异兽复苏,都是我的菜; 外星文明即将入侵,倒计时十年,请准备迎接; 神明百年后降临,届时将奴役蓝星…… 蓝星只是一级文明? 外星异族:谁说的,站出来试试! 万族入侵,华夏禁行!太古年间 四大神兽争锋 引得妖修进入狂潮 公元521年间 四大神兽 古麒麟 古青龙 古白虎 古玄武传承....万古第一佛,万古第一神佛,太古第一佛,太古第一僧,太古第一神。华夏少林寺大和尚释永心修炼100年,证得罗汉道果。虹化飞升,抵达异界,再度开启新的篇章! 焚身以火,让业火烧熔我;燃烧我心,唱出佛的颂歌。燃烧色身,投进佛的圣火。我不愿意,让五蕴埋葬了我。 焚心以火,烫上佛的深烙。燃烧的心,不让贪嗔痴埋葬了我。燃烧色身,投进佛的圣火三年前,他家道衰落,被迫退婚! 三年后,他功成名就,强势归来! 作为战神,为了龙国安宁,他选择放下昔日仇恨;可让他没有想到的是,同袍竟利欲熏心,与仇人结盟谋害自己! 所幸天无绝人之路,林天权大难不死! 三年前,他能成就一方战神,三年后,他依旧能以天人之姿,让那些陷害自己的人,付出百倍、千倍代价!由于核战争的爆发,大量的能量,摧毁了地表许多的城市但是一直在各种动植物体内沉睡的基因苏醒了。各种各位出现过的神奇动植物都出现。人类的生存空间越来越小……乱世之中为了能让自己的兄弟姐妹们有一个安身立命之所,他倾尽全力带领手下把一个小小基地,建成了一个足可媲美三大阵营都城的城邦,他半生中之身单挑三大尸王,率众对抗鹰美联邦,粉碎了敌人一次次的进攻,他和他的部众南征北战,东挡西杀,创下万世不拔之基,留下无数传奇故事。可他确在事业如日中天之时,选择了功成身退,带着爱侣远赴海外荒岛,做起了一对神仙眷侣高阳原本是个蓝星的雇佣兵,在一次执行任务中来到了金庸武侠世界--神雕。 在神雕世界中获得武林中人梦寐以求的武林秘籍,左手六脉神剑、右手降龙十八掌,年纪轻轻就达到别人一辈子的成就, 一个小小的蝴蝶能带动多大的效应?神雕世界因为高阳的到来又会有什么样的变化?神雕中的爱恨情况是否因为高阳的到来而改变? 让我们走进神雕世界,看高阳如何在江湖中翻云覆雨~~~~~ 各位书友要是觉得《神雕之我是大魔王》还不错的话请不要忘记向您的朋友推荐哦
怒血狂侠传 星燃X鬼魂袭 黑暗之神成神之路 疯了!代课两月,竟全考985 一个弱者的英雄梦 王者:纵横天下 玄皇归来 焚天古神 飞吧,实习医生 劳驾,我想问个道! 落石惊天 我与守护灵 陆天仙帝 黑白暗涌 叱咤沙场 没钱上大学的我,继承了爷爷的地府 公子无双 大秦:深宫签到十八年,出世陆地神仙 我是一名通灵师 写字作画成祖神 宝宝要多久会滚 宝宝滴耳液滴进去没有东西流出来 五个月宝宝坐飞机要买票吗 宝宝玩具哪些品牌安全放心 宝宝要多久会滚 24周胎宝宝有多长 五个月宝宝坐飞机要买票吗 四个月宝宝爱舔要阻止么 9个月宝宝能吃羊肉吗 5岁宝宝能喝绿豆汤吗 9个月宝宝吃牛肉 9个月宝宝吃牛肉 怎么让宝宝知道饱饿 宝宝滴耳液滴进去没有东西流出来 一岁宝宝每天户外活动时间 宝宝玩具哪些品牌安全放心 4岁宝宝总做梦 9个月宝宝能吃羊肉吗 坐飞机可以带宝宝润肤露吗 宝宝坐着往前趴 宝宝滴耳液滴进去没有东西流出来 2岁宝宝吃了芝麻油渣会怎么样 三个月宝宝晚上舔被子 1岁宝宝吃鱼肝油好吗? 8个月宝宝可以坐火车吗 怎么让宝宝知道饱饿 9个月宝宝能吃羊肉吗 三个月宝宝晚上舔被子 坐飞机可以带宝宝润肤露吗 9个月宝宝能吃羊肉吗 宝宝玩具哪些品牌安全放心 宝宝床上摔下来打到头会不会影响智力呢 女宝宝名字里面有“煊”字 一岁宝宝每天户外活动时间 宝宝吃母乳照片 宝宝玩具哪些品牌安全放心 女宝宝名字里面有“煊”字 五个月宝宝坐飞机要买票吗 怎么让宝宝知道饱饿 2岁宝宝吃了芝麻油渣会怎么样 一岁9宝宝手老放嘴巴为什么 5岁宝宝能喝绿豆汤吗 宝宝坐飞机可以用出生证复印件吗 4岁宝宝总做梦 1岁宝宝吃鱼肝油好吗? 宝宝滴耳液滴进去没有东西流出来 9个月宝宝吃牛肉 一岁9宝宝手老放嘴巴为什么 怎么让宝宝知道饱饿 乳头太大宝宝不好吸奶 亚星官网 亚星游戏官网 亚星官网 亚星官网 亚星游戏官网 无编军人 玄幻:北玄之下再无剑帝 神明之间 死亡回忆博物馆 看江 澳门葡京游戏官网 AG真人 快连下载 澳门葡京游戏官网 欧博游戏官网 宝宝床上摔下来打到头会不会影响智力呢 宝宝可以一直喝2段奶粉吗 9个月宝宝能吃羊肉吗 宝宝坐飞机可以用出生证复印件吗 宝宝侯喘的偏方? 宝宝吃母乳照片 五个月宝宝坐飞机要买票吗 宝宝坐着往前趴 宝宝坐飞机可以用出生证复印件吗 乳头太大宝宝不好吸奶 爸爸妈妈写给宝宝的信 宝宝滴耳液滴进去没有东西流出来 8个月宝宝可以坐火车吗 宝宝玩具哪些品牌安全放心 1岁宝宝吃鱼肝油好吗? 女宝宝名字里面有“煊”字 宝宝可以一直喝2段奶粉吗 9个月宝宝吃牛肉 宝宝坐飞机可以用出生证复印件吗 宝宝玩具哪些品牌安全放心 五个月宝宝坐飞机要买票吗 宝宝坐着往前趴 坐飞机可以带宝宝润肤露吗 1岁宝宝吃鱼肝油好吗? 一个多月的宝宝爱舔 爸爸妈妈写给宝宝的信 爸爸妈妈写给宝宝的信 一岁宝宝每天户外活动时间 宝宝坐着往前趴 怎么让宝宝知道饱饿