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
劳动者最光荣作文500字六年级下册写景100作文大全快速写好英语作文刘小姐辞职材料作文留下人生足迹作文劳动者最光荣作文500字六级试卷作文真题快速写好英语作文留在春天的足迹作文800字考试为主题写一篇作文邻人感动的一件事作文劳动者最光荣作文500字六一儿童节的作文200邻人感动的一件事作文快速写好英语作文开门见山法的作文恪守诚信作文初二留下人生足迹作文留下人生足迹作文六年级珍惜学校作文六年级下册写景100作文快乐童年作文议论文留在春天的足迹作文800字六一同学的礼物作文六年级的作文题开心动物园作文400字刘小姐辞职材料作文李延隆gre作文六年级珍惜学校作文六一儿童节节作文这个世界,是一个令人匪夷所思的世界,自打我记事起,爹娘就曾告诉我,三百多年前,不知何事所致,不知何人所为,世界上的所有人突然就再也不会死亡,每个人都拥有着永恒的寿命……本文基于《阿给姆传奇》。 继肖国辉从避难所矩阵苏醒之后,在现实的地表世界生活了三十几年。在最后一次对海外避难所的远征之中受伤,回到77号避难所之后,在基础医疗设施的帮助下准备安度残生。此时的避难所已经是人去楼空,唯有曾经的保守派首领,避难所人类管理员代表科拉还在坚守岗位。作为迎来送往现实世界和阿给姆之间桥梁,科拉也在垂暮之年和基本瘫痪的肖国辉谈起了管理员之间代代相传的秘密,而内容和肖国辉几十年前在阿给姆大陆上每晚重复的怪梦有关。。 除了外表肢体的残缺,肖国辉的内脏器官也收了无法复原的重伤。眼看生命已经流淌到最后一滴,唯一的办法就是再次回到阿给姆世界之中,靠着“先知”的特权和矩阵中与现实不同的时间比例来继续曾经荒诞的传奇。散乱的群星已经归位,离去的神话自梦中返回,旧日的阴影盘旋缭绕,述说着不可看,不可听,不可想的真理。 若理智已被完全撕碎……我们又该相信什么?这个世界文道为尊,文人掌文箓,修文气,开文宫。 九品开窍文箓,一目十行,身轻体健。 八品修身文箓,文字加身,如有神助。 七品仁者文箓…… “诗词歌赋,笔墨丹青,棋艺话本这些你都懂?” “略懂略懂。” “都懂一点也行。” “是亿点点……” 官居一品,权倾朝野? 封王拜相,永享荣华? 不不不,身怀国家图书馆全部资料的李长安,无奈接受了,世人把他名字刻进圣庙的事实。 如果你正在读这段话,你已经昏迷了很久了,我们不知道这段信息会出现在你梦境的哪个阶段,但我们真心希望你能看到,请赶快醒来!世界上常有死人复活、绝症被治愈的传言,在当今崇尚科学的社会,这些谣传往往不攻自破。正所谓医有医道,大道三千,小道无数,凡事无绝对,你所听到的不一定是真的,你所看到的也可能是人为加工过的真相而已。这个世界是否还存在着一种不为大众所知的医学,它可以用独特的治疗方式治愈那些所谓的不治之症呢?如果有,是什么样的医学如此神奇?又是什么样的一群人在从事如此神秘的工作?他们背后又会有怎样惊心动魄的事迹呢?飞星坠世,山庄尽屠,一老一少骑着大青马离去,十余年后,小子出成,老人带着他重回少林,掀开五十年前的江湖风雨,故事之后,小子又该何去何从? 江湖一统,究竟是壮举,还是阴谋? 背后之人,到底是英雄,还是奸贼? 佛门四蒂,上浩传人,华山君子剑,川蜀姥姥山,又将卷起怎样的江湖故事?正当徐风在全球进化爆发后的10年后,通过自己的努力,好不容易当上物资搜寻小队队长的时候,因为一场意外。穿越回全球进化的半年前……一念天堂,一念地狱。 抛弃黑暗的过去,退役军医雷东选择做一个普通人——直到圣晶危机的爆发。 圣晶,所有人垂涎欲滴的能源,却引发了空前恐怖的生化危机,昔日繁荣的城市沦为不死族的圣地! 面对尸潮的袭击,极东古国当局却袖手旁观,背后竟然有更加恐怖的存在? 一千年,转瞬即逝。地下世界的霸主,HBY基金会一手遮天,阴影笼罩了整个极东。名为改造者的“魔族”重出江湖,基金会的堕落天使咀嚼邪恶,注视着深渊! 人类的始祖号召凡人与魔族并肩而战,对抗来自天上之人;上百位魔族的权威,诸位“罪恶圣人”兴风作浪,百圣争鸣! 雷东早在他不再平凡的那一瞬间,就卷入了风暴的中心点——只有消灭“堕落的天使”们,扭转魔族与凡人互相争斗的现状,这个世界才有救! 无辜的灵魂才有救! 一位家境贫寒的少年,经历了常人难以想象的苦难,磨砻砥砺,奋发向上。好不容易华丽转身,完成了人生意义上的大逆袭,一时平步青云,风光无限! 这期间,少年也先后得到了好几位绮年玉貌少女的青睐,演绎出许许多多荡气回肠,缠绵悱恻的爱情故事。其中的情与理,是与非,仇恨与挚爱,痛苦与欢乐,人性与心魔,交互编织成一道道直逼心灵拷问的风景,让人热血沸腾又扼腕长叹!
都市狂龙 我不想变得和它们一样 这个游戏玩不死你 荒事 全球御兽:开局觉醒SSS级天赋 云战山河 游神笔记 影视:我有一扇穿梭门 科技式修仙 月神阁 江湖之石破天惊 我在人间当道士 一印天下 元素大陆的异能者 寂寞空间 来这世界走一遭 寻找五五开 重生奶爸:我打造娱乐帝国 再生世界 神魔偃骨刺 邻人感动的一件事作文 开心动物园作文400字 劳动者最光荣作文500字 留在春天的足迹作文800字 邻人感动的一件事作文 开门见山法的作文 快速写好英语作文 李延隆gre作文 军人最可爱的人作文 六年级毕业考作文范文 刘小姐辞职材料作文 零花钱支出英语作文 科技手抄报作文 开心动物园作文400字 六级试卷作文真题 留在春天的足迹作文800字 快速写好英语作文 军人最可爱的人作文 留下人生足迹作文 恪守诚信作文初二 开心动物园作文400字 竞争的英语作文120 快乐童年作文议论文 精彩的生命600字作文开头 考试为主题写一篇作文 六年级毕业考作文范文 开心动物园作文400字 精彩的生命600字作文开头 精彩的生命600字作文开头 考研英语2小作文 留下人生足迹作文 军人最可爱的人作文 刘小姐辞职材料作文 劳动者最光荣作文500字 六一同学的礼物作文 六年级的作文题 刘小姐辞职材料作文 竞争的英语作文120 六一同学的礼物作文 零花钱支出英语作文 六年级的作文题 科技手抄报作文 六年级珍惜学校作文 令人难忘的错作文600字 邻人感动的一件事作文 军人最可爱的人作文 老梁猜高考作文题 六年级的作文题 六年级毕业考作文范文 恪守诚信作文初二 亚星官网 亚星官网 亚星官网 亚星游戏官网 亚星官网 宗门养成:我的弟子都是主角模板! 危机末世:这次定要娶你 寂灭星主 超能剑神黎明的死神 一念山河烬 澳门葡京游戏官网 葡京官网 AG真人 澳门葡京游戏官网 万利官网 开心动物园作文400字 留下人生足迹作文 六级试卷作文真题 邻人感动的一件事作文 留下人生足迹作文 留在春天的足迹作文800字 邻人感动的一件事作文 考试为主题写一篇作文 老梁猜高考作文题 考试为主题写一篇作文 劳动者最光荣作文500字 六一儿童节节作文 劳动者最光荣作文500字 考研英语2小作文 快速写好英语作文 恪守诚信作文初二 六年级的作文题 竞争的英语作文120 考研英语2小作文 老梁猜高考作文题 竞争的英语作文120 篮球生母爱作文600字 令人难忘的错作文600字 六年级下册写景100作文 六年级珍惜学校作文 精彩的生命600字作文开头 考试为主题写一篇作文 开心动物园作文400字 令人难忘的错作文600字 六一儿童节的作文200