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
四川发行的蜀都邮票1975年邮票价格是多少钱大漠雄关邮票介绍香港五元伊丽莎白邮票2017年8月1日发行邮票四川发行的蜀都邮票纪46邮票发行日期大漠雄关邮票介绍牡丹全套邮票价格2016拜年邮票图外国红十字邮票大版广州哪里有收购邮票的2006一13航天邮票价钱外国红十字邮票大版日本邮票 信封j t邮票价格目录小型张邮票的价格香港五元伊丽莎白邮票香港五元伊丽莎白邮票元世祖出猎图邮票专册一带一路邮票珍藏册2017年8月1日发行邮票2017四方联邮票价格十二生肖邮票图片熊猫恐龙邮票多少钱一张1975年邮票价格是多少钱大漠雄关邮票介绍中国人民解放军建军九十周年邮票元世祖出猎图邮票专册西游记 二 邮票多少钱 “你已经取得资格,准备好回归了吗?” “不,那外面,才是真正的囚笼!” …… 那一天,有人格缺陷的平凡青年孟渭澄的颓废生活被搅乱,莫名其妙的超自然现象降临在他的身上,最终获得了奇妙的力量——“捷”。他不知道这是福佑还是诅咒,顺着那个也许根本就只是幻觉的指引,踏上了成为“圣者”的旅程。 从大兴安岭来到围子的外乡人于不易,通过一些奇遇被人尊称为母子,在围子这片土地上一统围子,立新王朝,国号为母,世人称其为围子大帝。传说围子大帝和旗下7个大将,在如今已经成为天上的8位大仙也就是围子八仙。广袤无垠的宇宙,充满了未知,仰望星空,生命的源头在那一颗又一颗美丽的星辰上跳跃……“变成一条龙是什么体验?” 叶寻变异了,拆完一个陌生快递,开启了疯狂的觉醒之旅。 他变成了真正的肉食性猛兽,食量剧增、力量疯涨,还因此而收获了美女总裁的垂青。 当叶寻力挫情敌,俘获佳人芳心,开始走向人生巅峰的时候,一场全球危机悄然降临…… 龙魂再现,守护华夏!我乃计都星下凡,先天便拥有阴阳眼。未出生就遭人算计,不足月被人挖出母体,先天有缺,易招恶鬼,命格犯煞,注定活不过百日。在奄奄一息之际,幸得牛四海相救,从此跟随其生活在一起,耳濡目染,终成一方守界人,自此可与神灵交流,可随意出入地府,逆天改命!一个杀手在一个平行世界的故事,开始便陷入了阴谋之中,从冷酷无情到被爱融化,最后……萧央重生平行世界,这世界没有前世那些大明星,大导演,大作家,于是他笑抽了。 随便写写小说,版权费到手,随便写首歌,火爆全国…… 但是他的梦想还是当个光鲜亮丽的演员,或者,能做个大导演岂不更好?   (本书企鹅号:436276579)楚君玄一穿越,就遇到了神仙姐姐被人追杀,本以为会死,却被一块青玉所救…… 夺仙人之躯的楚君玄,随手一掏,就是仙家法宝;入住全是少女的秋水宫;与一众仙子、妖女打得火热;和李靖、秦叔宝、李淳风等大唐英豪们称兄道弟、斩妖除魔…… 妖魔两族来袭,人间经历大劫,七大妖王、八大魔头、九真五佛,高手如云,一场波澜壮阔的妖魔大战开启…… 被鲜血洗涤, 也不能使信念动之分毫 被黑暗笼罩, 光芒永不熄灭! 千年过往,揭露自己身世。 迪诺外传,暴露任务秘密~ 一切都是骗局? 不,你所想象的,远不及那一切的真相! 《米瑞斯之诺亚光辉》第二部强势来袭。 拯救阿玛迪斯星的征途中,也不妨一起来探寻,米瑞斯与米梦樱的秘密吧! 郑前上一世文史出身,古言过目不忘,口吐古言成为儒释道大师兄。 正气、佛子、气运的集成,苟而不得的苦恼,一边苦恼一边口吐古言引动天地异象,一路高歌突破,成为大势所趋、人心所向、天命所归的存在。 但是他与人为善,低调做人,不愿做出头鸟,只想做一个上层人的边角料。
双苼 末代剑尊 信任的冲击 弑天药帝 我在殡仪馆玩推理 多重灵格 异変 守望:光与暗的对决 御天剑仙 豫品书生南行记 夺夜之光 魔道巅峰之剑灵传说 第四大陆:冰火重生 坐稳扶好!下一站娱乐圈! 坐化三千年,发小变女帝? 只为再见你一次 王二浪的幸福生活 我的傻丫头,偷听我的心声 刘小狗的罪恶人生 大唐之何方道友在此渡劫 10月21日发行的邮票 j字邮票价值 2000龙邮票2.8元 外国红十字邮票大版 10月21日发行的邮票 十二生肖邮票图片熊猫 上海制藏价邮票猴年 2006一13航天邮票价钱 中国人民解放军建军九十周年邮票 1991年北方邮票年册 一带一路邮票珍藏册 一带一路邮票珍藏册 元世祖出猎图邮票专册 j字邮票价值 日本邮票 信封 2017年8月1日发行邮票 2017四方联邮票价格 中国人民解放军建军九十周年邮票 1975年邮票价格是多少钱 四川发行的蜀都邮票 2016拜年邮票图 大漠雄关邮票介绍 1975年邮票价格是多少钱 74到82年邮票价格 2006一13航天邮票价钱 元世祖出猎图邮票专册 中国人民解放军建军九十周年邮票 1975年邮票价格是多少钱 1982邮票价格 中国人民解放军建军九十周年邮票 外国红十字邮票大版 2016拜年邮票图 香港五元伊丽莎白邮票 四川发行的蜀都邮票 元世祖出猎图邮票专册 2017年8月1日发行邮票 恐龙邮票多少钱一张 上海制藏价邮票猴年 元世祖出猎图邮票专册 恐龙邮票多少钱一张 2017年8月1日发行邮票 西游记 二 邮票多少钱 广州哪里有收购邮票的 2017四方联邮票价格 j t邮票价格目录 2016拜年邮票图 一带一路邮票珍藏册 2017年8月1日发行邮票 宗易汇邮票是骗局吗 纪46邮票发行日期 亚星官网 亚星官网 亚星游戏官网 亚星官网 亚星官网 青蛙的呓语 回到过去当盖亚 穿越异界,我乃天命主角! 将军荣耀之武道不孤 未来竟是无法舍弃的过往 亚星游戏官网 万利官网 欧博游戏官网 亚星游戏官网 葡京官网 大漠雄关邮票介绍 74到82年邮票价格 2017四方联邮票价格 中国人民解放军建军九十周年邮票 外国红十字邮票大版 牡丹全套邮票价格 j字邮票价值 最早的邮票有哪些 上海制藏价邮票猴年 恐龙邮票多少钱一张 恐龙邮票多少钱一张 一带一路邮票珍藏册 牡丹全套邮票价格 2000龙邮票2.8元 十二生肖邮票图片熊猫 1982邮票价格 四川发行的蜀都邮票 宗易汇邮票是骗局吗 2016拜年邮票图 10月21日发行的邮票 2017年8月1日发行邮票 2006一13航天邮票价钱 大漠雄关邮票介绍 上海制藏价邮票猴年 j t邮票价格目录 大漠雄关邮票介绍 中国人民解放军建军九十周年邮票 一带一路邮票珍藏册 一带一路邮票珍藏册 纪46邮票发行日期