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
我最崇拜的人-作文英语作文有家的物品安徽专升本语文作文gmat作文改革未来英语作文70词我最崇拜的人-作文北京高考作文 老腔安徽专升本语文作文专升本英语作文大全我会去整容英语作文一景一物总关情作文安徽专升本语文作文四年级下册教材作文一景一物总关情作文男女生交往的作文我会去整容英语作文高考预测作文题目250字作文七篇250字作文七篇mba英语作文难吗现代科技的英语作文250字作文七篇专升本英语作文大全学会观察作文PpT我努力我快乐+作文16阳江中考作文我努力我快乐+作文学会观察作文PpTmba英语作文难吗四年级下册教材作文没有奇遇,没有转生,没有背景,天赋一般,所有客观条件与一般人无异的黑羽,以主角18岁为起点的故事某社畜穿越武侠世界,重生成为少年时代的林平之,觉醒签到系统。 只要在特殊场景中进行签到,就能得到逆天奖励! 青城派围攻福威镖局的场景中——“是否进行超级签到?” “是!” “签到成功!恭喜获得昆仑三圣何足道之绝学《迅雷剑法》!” 凭借着系统金手指,他打破命运,成功改变原来的悲惨人生。 从此,美人入怀,仗剑而行,探寻武道之巅,只为逍遥九天! 朝阳之下,尽数向阳; 岐山,坐落在藏山中,鲜为人知的地界; 人迹罕至、毒瘴环生,望眼去尽数被山林遮挡,便是全貌; 蜿蜒的山脊许是蛰伏经年猛兽。 一纸“红”卷,牵引着少年入世,将会是此间动荡的征兆!和平安宁的世界被一场突如其来的盛大流星雨给彻底打破了。 丧尸、变异生物、来历不明的病毒席卷了全球。 二十二个塔罗教悄然出世,身蕴龙脉的华夏大地吐出了龙息。 这究竟是一场被精心策划的闹剧还是一次没有挽回余地的终末之诗? “嘿,听着。”唐南故的眼神里充满了坚毅。 黑色如鳞片的角质层如铠甲一般覆盖了身体的每个角落, 无数的红色丝线从左手争先恐后地钻出,飞快地凝聚出刀锋的雏形。 右手同样被坚硬的麟甲包裹,只是紧紧地握着腰间的一柄刀鞘漆黑的长刀。 神圣的金光从胸膛处喷涌而出,黑色的身躯被镀上了一层闪耀的光辉,此时的他就如同一位被圣光笼罩的黑暗骑士,矛盾却不违和。 来自远古的气息从他的身上散发出来,就连周围的草木都为之颤抖。 “在这个末世里,”他将深蓝神秘的刀刃从刀鞘中拔出,在空气中划出完美的弧线。 “我可是横着走的啊!”一朝红日出,依旧与天齐。 破釜沉舟,死后轮回吗? 如日东山能再起,大鹏展翅恨天低! 这一年,轮回路上,女子一柄长剑,破开阴阳…… 浮世三千,吾爱有三,日月与卿,日为朝,月为暮,卿为朝朝暮暮…… 被迫害的李只能带着一对B去打NBA, 本来只想混两年就买只球队当老板, 没想到阴差阳错, 居然混到了总冠军。何须问,浮生情,原知浮生是梦中。 花落花开,人死只是重生的开始。 广袤无垠的具象大陆,具象者们,打通三脉七轮,修炼着脉气。 根轮开,红莲绽放,具象现: 腹轮开,橙莲绽放,具象量变: 脐轮开,黄莲绽放,变化现: 心轮开,绿莲绽放,生命现: 喉咙开,蓝莲绽放,灵性现; 额轮开,紫莲绽放,智慧现: 顶轮开,千瓣莲花,彩虹现。 红十具象师,橙百具象师,黄千具象师,灰迷具象宗师,绿生宗师,蓝灵宗师,紫归宗师,彩虹尊者。 生命之花,如此璀璨,如果可以,我愿奉献!陌生朝代一品大将府的庶子,突然融合了一个现代人的记忆。 这段记忆会给他带来怎样的变化?又会给这个世界带来怎样的变化? 2025年,本来一派和平的地球突然发生了一件大事。 在8月20号时,几个国家的城市中有流光降落。 这些流光带来了极其可怕的黑山羊,将城市变成了人间炼狱。 此后,陆续有流光降临了其它的城市。这些城市无一例外,都生灵涂炭。 面对强大的黑山羊,一名少年,在稀里糊涂的情况下,走入了红华大学中。 他,和一群战士,将会成为黑山羊的噩梦……一不小心穿越到1662年的南明太子朱慈爝身上,是49年入某军,还是能够在末日余晖中绝地反击,肩负起复兴汉人江山的伟业?
寻神器记 末世异能之王 非同寻常的治疗 起航时代 乱世剧情 女帝的神级妹夫 蛆先生的一生 我变成了鬼! 绝!颜 我在异世召唤同班同学 左不比传奇 我岳父是齐天大圣 看那一弯新月 十方世界,我为地仙之祖 耀世九乾坤 全球觉醒,从觉醒模拟器开始无敌 神医胆子大,校花放产假 抚剑吟 苍云落日 无有善 一事一议作文指导 协警考试命题作文 高考预测作文题目 未来英语作文70词 一事一议作文指导 作文不管路有多远 高考预测作文题目 语言的作文60字 16阳江中考作文 介绍房子的英文作文 校园书展 英语作文 校园书展 英语作文 教育作文200字 协警考试命题作文 我最崇拜的人-作文 未来英语作文70词 罗马的建筑多作文 16阳江中考作文 初中英语作文咋讲 安徽专升本语文作文 协警考试命题作文 安徽专升本语文作文 初中英语作文咋讲 一景一物总关情作文 我会去整容英语作文 教育作文200字 一事一议作文指导 英语作文有家的物品 初中英语作文咋讲 16阳江中考作文 未来英语作文70词 高一作文常用短语 gmat作文改革 我最崇拜的人-作文 学会观察作文PpT 我努力我快乐+作文 gmat作文改革 高考预测作文题目 教育作文200字 男女生交往的作文 我努力我快乐+作文 介绍房子的英文作文 写亲情作文的提纲 罗马的建筑多作文 一景一物总关情作文 高一作文常用短语 校园书展 英语作文 我努力我快乐+作文 教育作文200字 北京高考作文 老腔 亚星官网 亚星官网 亚星官网 亚星游戏官网 亚星官网 霸婿崛起 修罗斩道 我在末世飚个车 逐渐离谱的故事 大明:满朝奸臣,你让我登基称帝? 亚星管理平台 亚星官网 万利游戏官网 亚星管理平台 澳门葡京游戏官网 一景一物总关情作文 北京高考作文 老腔 高一作文常用短语 未来英语作文70词 我会去整容英语作文 教育作文200字 写亲情作文的提纲 mba英语作文难吗 介绍房子的英文作文 协警考试命题作文 四年级下册教材作文 初中英语作文咋讲 一事一议作文指导 四年级下册教材作文 我努力我快乐+作文 英语作文有家的物品 作文不管路有多远 作文不管路有多远 校园书展 英语作文 写亲情作文的提纲 介绍房子的英文作文 初中英语作文咋讲 16阳江中考作文 英语作文有家的物品 北京高考作文 老腔 gmat作文改革 一景一物总关情作文 北京高考作文 老腔 罗马的建筑多作文 北京高考作文 老腔