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
四年级语文园地6作文ppt课件我又做好事了作文400字五年级作文美术小能手我们是好伙伴作文征文我的严厉爸爸作文800四年级语文园地6作文ppt课件为何作文写不好五年级作文美术小能手我是勇敢的作文800字未来手机可能英语作文我是个 的女孩作文300字五年级作文美术小能手四年学期总结作文我是个 的女孩作文300字我敬佩的生命作文300字未来手机可能英语作文我心中的什么什么作文600字作文我和同学四年级作文400字作文400字作文我的严厉爸爸作文800五年级下册苏教版作文大全四年级作文家乡变了我和同学四年级作文400字作文400字作文我是勇敢的作文800字说明文的200字小作文说话技巧作文素材我最喜欢的一篇作文350说话技巧作文素材天津今年高考作文五年级下册苏教版作文大全四年级小蚂蚁作文200“三更堂?阎王让你三更死,谁敢留你到五更的三更堂?” 胖哥,先为不可胜呀,算无遗策呀,智珠在握呀。被打的吐血还在这装? 兄弟二人,美女撑腰,携酒上吟亭,满目江山列画屏。喜欢这部作品的读者可以加QQ群:594509232。一起与作者和读者讨论剧情哦~ 黑暗降临世间,母亲意念魔女不敌四人的战力,致男主易恒与女主易贝儿与母亲离散。 转眼十年过去,他们将要面对的是全新的十二位天赋异禀的星座使教徒。 为了拯救妈妈和世界,他们做出着艰难的决定:改变! 异世界的故事,便是从这里开始的。。。。。。一个充满神奇色彩的世界,在这里,一切都是未知的,但是,一切都是被记录的的。天是什么,是一部法典,一部恐怖的法典,不过,法典是什么呢?哦!法典就是用来查阅的,管我,凭什么,法典就是法典还是乖乖的做好你的本职吧!本应平凡,却阴差阳错,这一天,天逆了,人变了,他还是他吗......星辰变,乱世起,意外的流星,意外的出生,血腥、挫折,还有家散,成就了他的不凡,他是谁?到底是谁呢?弥漫在空气中的各种元素微粒,他们在运用着自己的力量在使用它们,聚合、变质、融合等等,各种各样的变化,这是元素与灵魂相存的世界,灵魂运元素,元素依灵魂。他,长生王者,为了却心愿,乘兴而归,甘愿伴她左右,护她周全。 为她,逆了天下,只为一言之诺,蓦然回首,踏血而歌! 为她,亡了诸国,只为一怒红颜,腥风血雨,血染皇城!一个新世纪助人为乐的自动武器与弹药工程专业的硕士,一次喝多了阴差阳错被天外流光砸中入了地府。被宿醉的阎王判入了完全没听说过的修行时空,这里不再有成熟的社会体系,不再有丰富实用的科技产物,有的只是各种兽气拟兽的功法,特殊的肉体条件还有完善的修炼体系。发现自己误事了的阎王主动再投胎转世前想要给予一些秘籍补偿,又因为记错了转世所去的时空情急之下随手不长了少年一本大道至简的剑法精要。还未喝下孟婆汤就被送过奈何桥的褚笑:“你这是弄啥嘞,周围都是什么兽气外显以气拟兽的,你给本没有练气方法的剑法有啥用?”看褚笑如何在这个兽气拟兽主导的世界,和上辈子砸死自己的造化印一起做一个……剑客!“你写下的愿望都将成为现实,但是……”意外穿越来到平行世界。 陈宇绑定了“究极治愈游戏系统。”开启了新的人生。 只不过.... 这治愈游戏好像有些不同。 303公交往事的护士女鬼姐姐来治愈你。 青峰精神病院的慈祥老奶奶来治愈你。 寂静中学的柴刀学妹告诉你沉默是金。 牛角村的小嫂子告诉你要相信唯物主义。 一个个游戏被陈宇发布出来,而他家里的刀片已经堆积如山。 所有玩家都在拼命地寻找着他的住处,纷纷表示想要“友好拜访。” 数学鬼才时三九提出了一个神仙猜想,震惊世界! 他坚信0和1之间还有一个隐匿的数字, 只要证明它的存在,就能拥有穿越时空的能力, 就在他证明这个数字存在的那一刻, 正如他所料,他穿越时空了! 只不过这个世界他闻所未闻,甚是奇异诡谲··· 新的世界,等你和时三九一起探索!为了逃避战友的逝去,三年的海外兵王回来了。张不苦选择开启自己的大学生涯,只是,自己重新获得生活依旧躲不开最终的宿命。 你这一生所遇见的人是你注定所遇见的,你遭受的苦难是你注定所遭受的。 这一世,我不想再失去。御临河传奇
彼岸落笔 玄界灵尊 如果是我呢 逆道殒天 进击的未名人 度魂刀笔师 一百个人的故事 都市之医神下山 四方仙途 恶魔天 铁血狂徒之周姐是我妻 潮起之时 云翎说 无聊的我被无聊死了 疯秀才,开局选亲白虎女 两个欢喜冤家 开局绑定英雄联盟 E界 高田寨传纪 我在王者捡技能碎片 我做了件好事作文500字 我们是好伙伴作文征文 未来手机可能英语作文 四年级写人写事作文 我眼中的夜空作文3OO字 我是勇敢的作文800字 未来手机可能英语作文 四年第六单元4百字作文 我最喜欢的一篇作文350 四年学期总结作文 五一节的趣事作文500字 五一节的趣事作文500字 五年级下册园地八作文ppt课件 我要做个好学生作文300 四年级语文园地6作文ppt课件 我的严厉爸爸作文800 我做了件好事作文500字 我与小伙伴400字作文600字 王小波阅读作文素材 五年级作文美术小能手 我要做个好学生作文300 五年级作文美术小能手 王小波阅读作文素材 我和同学四年级作文400字作文400字作文 未来手机可能英语作文 五年级下册园地八作文ppt课件 我与小伙伴400字作文600字 王小波阅读作文素材 王小波阅读作文素材 我最喜欢的一篇作文350 我的严厉爸爸作文800 我是小导游作文故宫 我们是好伙伴作文征文 四年级语文园地6作文ppt课件 说明文的200字小作文 说话技巧作文素材 我们是好伙伴作文征文 我眼中的夜空作文3OO字 说明文的200字小作文 我敬佩的生命作文300字 说话技巧作文素材 四年第六单元4百字作文 五年级下册苏教版作文大全 我做了件好事作文500字 我是个 的女孩作文300字 我是小导游作文故宫 五一节的趣事作文500字 说话技巧作文素材 五年级下册园地八作文ppt课件 我心中的什么什么作文600字作文 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 国医:开局扮演神级手术大师 清河王 超级农民工 拔刀问苍天 横扫无双 欧博官网 亚星游戏官网 亚星官网 欧博官网 亚星管理平台 五年级下册苏教版作文大全 五年级作文美术小能手 我是小导游作文故宫 五年级作文美术小能手 四年级写人写事作文 我们是好伙伴作文征文 王小波阅读作文素材 我与小伙伴400字作文600字 我又做好事了作文400字 我和同学四年级作文400字作文400字作文 我们是好伙伴作文征文 我是个 的女孩作文300字 我心中的什么什么作文600字作文 我做了件好事作文500字 我是个 的女孩作文300字 说明文的200字小作文 为何作文写不好 我做了件好事作文500字 我做了件好事作文500字 未来手机可能英语作文 我是个 的女孩作文300字 四年级作文家乡变了 四年级写人写事作文 五年级作文美术小能手 四年级语文园地6作文ppt课件 我又做好事了作文400字 四年第六单元4百字作文 我心中的什么什么作文600字作文 我与小伙伴400字作文600字 天津今年高考作文