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
一封邀请信英文作文3年级第3单园作文下册雅思作文关于青少年英语作文提分词组程红兵高中作文教学一封邀请信英文作文二年级下册作文教学雅思作文关于青少年遇突发危险英语作文作文我眼中的评课作文——象山影视城一封邀请信英文作文全国卷历年作文题目作文——象山影视城雅思作文关于青少年作文我眼中的评课写不来作文怎么办高考作文情怀与冷漠高考作文情怀与冷漠写roy的英语作文新学校新环境作文英语3及考试作文医学发展 英语作文4年级语文园地五的作文程红兵高中作文教学2013年专四优秀作文常熟之秋作文怎么写英语作文提分词组高考作文情怀与冷漠新学校新环境作文在这个世界,人族,妖族,魔族,三足鼎立不知多少万年,无数个年头来,多少惊才绝艳之辈,而今天要讲的,则是一个人族少年的故事。平平无奇的法师,不一样的冒险之旅。杨羽穿越玄幻世界,面对狗男女欺压,生命危在旦夕时,开启狂暴吞噬系统。 系统开启,一切皆可吞! 从此天地色变,唯我吞天魔祖!已经是2678年,地球资源即将枯竭……在一个极度内卷的时代,今天又该如何生存是一半人每天都在思考的问题。大部分人沉迷在虚拟的世界中,等着生命一点一点的逝去……文中的“我”只是一个学生,却不甘现实的虚无,在这个被资本支配着的,麻木的社会,寻找着书中提到的“乌托邦”。 “极数在九”,九皇子云辞一把&amp;quot;沉浮剑&amp;quot;在手。年少时的梦想是如父王一般成为万世瞩目的帝皇,让天下臣服,让百姓安居乐业,让云皇朝的国旗飘满世界八荒。 皇子正式踏入修炼,在修武路上,自成一脉,开宗立派,成为帝王统一云左大陆,开战场,战鬼族,抓蛮兽…… 统一人族,带领云左大陆忠心耿耿的部下一起封神....... 在成帝这条路上,他没有辜负任何人,唯独对不起左蓉一人。 有的时候都在怀疑自己是对是错,可是这是我年少时的梦想啊……人族十大武帝各据一方。 再有东域黑龙王,南域裂天虎,西域通天树,北域天狐族等各大族群势力。 神荒时代末端,世间动荡,神物涌现,妖孽横生。 前世武帝万离,受圣物圣灵珠庇护,重生降临,修无上法诀,再入巅峰。 武帝入世,再览世间,万离: “神物三魂厌世灯?我要了!” “天狐族圣女,无垠圣体?正好身边缺个侍女。” “弑神殿?来多少我杀多少!”二十一世纪的科研天才李承风穿越大唐,居然变成了李世民的六岁儿子? ??天赐神级熊孩子系统,李承风揪李世民的胡子,开局狂怼房玄龄和杜如晦,他们对此却又无可奈何。 ??李承风利用自己的天才科学知识,一招南水北调解决天灾,研发出来的杂交水稻可亩产2000斤。 ??灭突厥,降伏高句丽,李承风六岁就被赐封为大唐镇国神王。 ??可谓莫愁前路无知己,天下谁人不识君? 一个另类的足球天才,一群热血的足球人,一切从零开始,逐步成长,从弱小变得强大,从中国走向世界。 足球理想、足球智慧、足球商业、国家精神、民族气度,所有元素都在《影球者》中,既虚幻又真实,在中华民族伟大复兴的路上,谱写我们的足球传奇。 本小说献给为中国足球腾飞矢志不渝,默默奉献,勤奋耕耘的人们。 抗日战争接近尾声,黎明之前最黑暗。历时21天的洛日城保卫战,中方弹尽援绝而失败,日寇占领千年帝都洛日城,为达到其不可告人的战略目标。日本最高统帅部计划实施其蓄谋已久的“一号作战”:改洛日城之名为福阳;调集日本国内玄学界高手,欲铲除我华夏玄学界领军人物,并企图斩断我华夏主龙脉。以实现福佑“日出之国”武运长久,大和民族繁荣昌盛,并妄想永久凌驾于我华夏民族之上的惊天阴谋。日寇的灭绝人性、疯狂掠夺和血雨腥风的殖民统治。激起了华夏玄学界及河洛儿女无比愤慨和前赴后继的殊死抗争,直至日寇如残阳凋零,我华夏巨龙长啸腾空。 他们说,如果做了神仙就好了,因为那样可以无忧无虑的,真的吗?   天蓬,你喜欢现在的生活吗?整天活在生死之中!   喜欢……是什么意思?   天蓬,你知道自己犯了什么罪吗?   知道,因我爱上了我所爱的人!   贬你入凡,散你修为,可服?   我……   我虽然是头猪,但我,不,任,你,们,宰!   为什么要骗我?为什么?   因为你傻啊!   大圣,此去欲何?   踏南天,碎凌霄   若一去不回……   便一去一回!   天蓬,我们终不能改变那个开始,何不忘了那个结局?   负尽千重罪,炼就不死心   现在我明白了,说我调戏仙娥,犯下天条,贬下凡尘,散我修为,要我了去凡心,我!不!服!   说俺大闹天宫,妖性大发,顽心不改,困我百年,要我戴上紧箍,像条狗一样顺从你们,我!不!服!   卷帘,当神仙痛快还是这闹天宫痛快?   三藏,倘若俺老孙一去不回,待到来生再吃你的肉! 生我何用?不能欢笑,灭我何用?不减狂骄。 这个天地,我来过,我奋战过,我深爱过,我,不在乎这结局!                        
白鹿源起 六界 传说 极道使魔 野火一卷 从散人开始 浊云录 万灵之眼 离乡三千里 洛阳亭 唯我超然 极点超神 太阳系的秘密档案 穿越异世界的我要教出最强 重生之我的九十年代 当集体穿越之后 道非身外 火影忍者穿越到日向家 残阳末剑 持剑傲天 我们一起闯荡的日子 国庆华诞66作文 五段英语作文模板 高考作文情怀与冷漠 38妇女节感恩作文 全国卷历年作文题目 写不来作文怎么办 英语3及考试作文 雅思作文关于青少年 二年级下册作文教学 1月23雅思作文 材料作文怎么找题目 材料作文怎么找题目 最好的学校英语作文 五段英语作文模板 新学校新环境作文 500字赞美人的作文 作文——象山影视城 国庆华诞66作文 常熟之秋作文怎么写 3年级第3单园作文下册 写roy的英语作文 3年级第3单园作文下册 常熟之秋作文怎么写 4年级语文园地五的作文 一封邀请信英文作文 苹果公司 作文素材 国庆华诞66作文 国庆华诞66作文 全国卷历年作文题目 写不来作文怎么办 达州中考作文大纲 一封邀请信英文作文 38妇女节感恩作文 30作文跑题能得多少分 医学发展 英语作文 4年级语文园地五的作文 500字赞美人的作文 材料作文怎么找题目 医学发展 英语作文 500字赞美人的作文 4年级语文园地五的作文 英语作文提分词组 新学校新环境作文 作文我眼中的评课 英语3及考试作文 材料作文怎么找题目 医学发展 英语作文 英语作文提分词组 达州中考作文大纲 二年级下册作文教学 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 转生成我自己?!! 重生:我竟成了天道之子 剑诀:登上巅峰的秘诀 傲世,修罗神 西游总导演 百度 百度 百度 百度 百度 全国卷历年作文题目 二年级作文学+跳绳 2013年专四优秀作文 常熟之秋作文怎么写 二年级下册作文教学 30作文跑题能得多少分 写不来作文怎么办 程红兵高中作文教学 苹果公司 作文素材 程红兵高中作文教学 写roy的英语作文 高考作文情怀与冷漠 新学校新环境作文 材料作文怎么找题目 新学校新环境作文 写roy的英语作文 30作文跑题能得多少分 新学校新环境作文 程红兵高中作文教学 3年级第3单园作文下册 38妇女节感恩作文 1月23雅思作文 38妇女节感恩作文 30作文跑题能得多少分 达州中考作文大纲 二年级下册作文教学 作文我眼中的评课 38妇女节感恩作文 二年级作文学+跳绳 英语3及考试作文 亚星官网 亚星官网 万利官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 欧博官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网