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
有关嘉定桥的作文有关变通创新的作文有特点的同学作文450字有关持之以恒的作文.有关童话的作文300字又见那抹绿色作文以责任为话题作文300字有特点的同学作文450字雨一直下作文600字写事有关水果的英文作文300字有关教师观的作文600字有关嘉定桥的作文小学作文描写春景有关家教作文有特点的同学作文450字有关水果的英文作文300字一篇珍惜生命的作文。一篇关于游记的作文400字作文一篇关于游记的作文400字作文游览长城的作文400字作文400字遇到困?y英文作文一篇关于游记的作文400字作文雨一直下作文600字写事源汇区作文名师有关童话的作文300字一个鲜明的人作文500字有关持之以恒的作文.源汇区作文名师优秀作文开头结尾点评小学作文描写春景“别人是被炮弹追着轰,我特么是被核弹追着炸!” 核弹灭世之后,主角被迫寻找修道寻仙之路。 然而作为一位修仙小白,遭受修仙门派收徒时的白眼。 “小白!你境界都没有!”守护修士冷眼看了过来。 “没有资格入门。” 可是主角我有金手指啊! “我特别强调一下:打我的时候需要控制力量,不许使用超过一成的力量!” “你们总是不听话!” 安临渊把头仰起,45度朝向天空, “我说不许使用超过一成的力量是在保护你们!” 在凡人地界,核武末世下走投无路的安临渊,迫不得已,被逼入进入阿尔卑斯门,寻求庇护。 安临渊开始走向修仙道路。 即使安临渊已经遁入阿尔卑斯门修仙求道,凡人地界依然未放弃对安临渊的追杀。 安临渊不断遭遇各种追杀。随着修仙境界的不断提升,被追杀的同时,也展开自己的复仇行动。一代冰皇的成长日记,接受黑暗之眼的男魔法师,在冰霜洗礼下成就阿拉德大陆最强冰皇少年李杉逃出生天后,进入小城。正逢下岗改制,他一脚踏进这个旋涡。 这是一个变革的时代,一个机遇丛生又步步惊心的时代。 他在阴谋迫害中自保,在明争暗斗中生存。 在达官显贵的权谋中游走,在血与火的锤炼中成长。 在各方势力的角逐中壮大。以旁观者的视角,鉴证一届朝堂的兴衰起落,记录一代江湖的恩怨情仇… 青苏入世十五载,回首前尘… 醇酒再烈,难咽不过满腔愤恨。 剑刃再锋,伤人不过浮华人心。 且听且看,满一壶浊酒,领略这庙堂与江湖的起伏波澜!写作总是没有头绪,思考较多,写作较少。 不爱学习,很难接受难以理解的新鲜事物。 刚开始写作,以为万事开头难。 后来发现,简直是步步难,一步一重天。 对于喜欢看书多一点的我,写作实在没有什么才情和耐心。 游戏只是游戏,游戏也是工作,除非是竞技类游戏。 小说只是小说,现实谁有空看小说,也许是我看久了小说,觉得没有什么趣味了。 日有所思,夜有所梦。梦只是梦,生老病死,信则有,不信则无。 构思、构思、构思。码字、码字、码字。 一大波小说正在靠近……选取,试读,下载,废寝忘食的读,有选择的观看。 是为观后感,心中所想,化为梦的翅膀。在自由的天地间翱翔…… 重生即为重来,再活一世。穿越即是交换人生,体验不同人生。 拿什么做比较才算贴切,就这双红色唯一的高跟鞋。陆琦的意外人生学神李安然高考前夕被天降陨石砸中,没想到却意外获得了宇宙互联网的登陆资格。 素蓉曾告诉我,要是我因为她的离开,心中的眼泪快掉下来的时候,就赶快抬起头,看看这片曾经属于我们的天空。   当天依旧那么的蓝,白云还是那么的潇洒,就不该再哭,因为素蓉的离去,并没有带走唐剑雨的世界,可是,在危难机来临之际,当我跟沈素蓉的命运纠缠的那一刻,属于我的世界也消失了。   只有我跟素蓉才是完整的天地,要是只有我,那只是一个寂寞而无止境的噩梦,素蓉,可怜的素蓉,要是真的有来生,我忠心的祈求上天,求求你,老天爷,求求你,不要让素蓉再遇上我,更不要让她再爱上我,就让她好好的平静度过来世,心中再没有我唐剑雨的出现。   就让我们过去的故事,永远埋在我心中,刻骨铭心就可以了。叶玄意外穿越到天玄大陆,依靠按摩推油马杀鸡终于觉醒了系统。 从此修为开挂似的增长,收天骄弟子,夺造化神兵,习逆天神通。 至此,叶玄开启了漫长的至尊之路。印象里,我好像有一个弟弟。我很小的时候父亲带着他消失了,那个时候我七岁,到现在怎么也想不起弟弟的样子,我甚至会怀疑,这个弟弟,会不会是我闲来无事现象出来的玩伴 嗯……作者新人,喜欢写一点奇奇怪怪的东西,可能还没有逻辑,就……咱们文明评论
剑之遥 潜踪王者 大乾:靖夜司 梦与世界的距离 孤岛惊魂365天 万法升仙 人生模拟:开局被邪教绑架 怒血狂侠传 万界第一皇 我在末世觉醒荣耀系统 这个捕快太行了 都市镇灵人 灵气复苏:古时曾有仙 我的玄幻模拟器 民间故事诡异 异界之我的科技帝国 兄弟修改人生是怎样的体验 这个召唤师不一样 核爆持铲青年 灵气复苏:从吞噬灵剑开始 有关成长的作文标题 有关生活的高考作文 一篇珍惜生命的作文。 一篇关于游记的作文400字作文 有关成长的作文标题 有趣的实验作文6年级 英语作文用高级词汇 游颐和园作文700 一个鲜明的人作文500字 小学作文描写春景 雨一直下作文600字写事 语文作文高中模板 优秀作文:开动脑筋 有关水果的英文作文300字 又见那抹绿色作文 有关童话的作文300字 英语作文用高级词汇 一个鲜明的人作文500字 遇到困?y英文作文 有关嘉定桥的作文 有关生活的高考作文 有特点的同学作文450字 有关变通创新的作文 有关家教作文 有关水果的英文作文300字 优秀作文:开动脑筋 一个鲜明的人作文500字 有关变通创新的作文 遇到困?y英文作文 一个鲜明的人作文500字 有关童话的作文300字 有关生活的高考作文 有一种辛福叫作文800字 有关嘉定桥的作文 源汇区作文名师 有关童话的作文300字 有一种辛福叫作文800字 一篇珍惜生命的作文。 优秀作文:开动脑筋 有特点的同学作文450字 有关持之以恒的作文. 小学作文常见类型 游览长城的作文400字作文400字 语文作文高中模板 有关家教作文 有关生活的高考作文 语文作文高中模板 有关持之以恒的作文. 优秀作文开头结尾点评 以责任为话题作文300字 亚星官网 亚星官网 亚星官网 亚星游戏官网 亚星官网 元宇宙天宫 女帝师尊,让我喊她媳妇? 墨羽笙箫传 天下一族 长江行第一集 亚星管理平台 亚星官网 万利游戏官网 亚星管理平台 澳门葡京官网 语文作文高中模板 游览长城的作文400字作文400字 有关童话的作文300字 英语作文用高级词汇 有关嘉定桥的作文 遇到困?y英文作文 有关家教作文 优秀作文开头结尾点评 有特点的人作文600字 有特点的人作文600字 有关嘉定桥的作文 有关嘉定桥的作文 优秀作文:开动脑筋 一篇关于游记的作文400字作文 有特点的同学作文450字 小学作文常见类型 有关水果的英文作文300字 友情网话题作文 有关持之以恒的作文. 一篇珍惜生命的作文。 有关变通创新的作文 小学作文描写春景 优秀作文开头结尾点评 雨一直下作文600字写事 小学作文描写春景 有关童话的作文300字 又见那抹绿色作文 又见那抹绿色作文 源汇区作文名师 优秀作文:开动脑筋