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
我看电影夜盗珍妃墓日本电影白色房间黎明演过的电影有哪些400天电影战马 War Horse - 电影 - 豆瓣电影 速度与激情7窟髅电影黎明演过的电影有哪些公鸡母鸡拖拉机电影主题歌大奥:百花?乱 电影电影鲜花歌曲我看电影夜盗珍妃墓下载罪欲电影香港电影警匪片特征黎明演过的电影有哪些大奥:百花?乱 电影逆转裁判电影百度网盘2015不伦电影2015不伦电影赛尔号5雷神崛起大电影完整版叶佩雯电影2015不伦电影公鸡母鸡拖拉机电影主题歌电影观音山肥皂战马 War Horse - 电影 - 豆瓣蛇妖电影大全有和尚的古装400天电影唐山大兄电影国语版观音山电影水下激情下载罪欲电影有没有想过三国时代最根源是从哪里来? 天下大势? 合久必分? 有没有想过是汉末第一导演袁绍谋篇布局了非常精妙的189年东汉皇权大崩塌...徐弘文本是一个工地包工头,后来世人称他披肩客之神,一个可以影响全球物价走势的神级大佬。 为了接工程,他小小年纪熟悉各路潜规则; 为了拿项目,他只身一人手持板砖大战钢管队; 为了签合同,他带领兄弟干翻亚丁湾南岸索马里海盗; 为搏,,,红颜一笑,他改变世界时尚风向。。。。。。 分手的那一刻,我手里有了一个亿,成为亿万少女的梦。踏遍十万星河寻觅,奈何六道轮回无你;开创太平盛世,而今仍是一人前行;散去无尽雷霆,却再未听闻你的声音;湮灭诸天狂风,却难感受你的呼吸;破开虚无混沌,但求凝视你的眼睛......可你在哪?你究竟在哪!梦中他是世间最古老的生命,长生不死神威盖世!梦醒他是世间普通一员。当有一天神话复苏,他赫然发现自己的梦竟是曾经的历史。而似乎神话时代的终结就是由他一手操纵,当神话再一次降临他又会走向何方!是再一次终结神话时代开创前途未卜的科技大道,还是融入神话成为那至高无上的不死至尊! 我是人!是盖亚!是生物!不是神!!!“pa!!!”北斗你是否清醒!!!山中怒拍桌子;艾斯,你个衰仔!!!给我起来把怪兽cao翻!!!圣诞老人指兽示意…当一切的一切变得暴躁起来,重生后的北川也应如是。 (小众文学只是想写一个自己幻想的奥特世界,随缘更新,第一次写文)我叫吴富贵,在我身上发生了离奇的穿越事件,我重生了到了一个魔法与武道共存的世界,我以为我是主角,主角应该不会死,但我发现我错得很离谱……彗星掠过 陨石坠落,丧尸横行。 …… 浩劫已至,人性、救赎、正义、挣扎,新的秩序即将建立。 遥望深空,所有的未解之谜即将解开。 你。 熟悉的那片天空,还是原来的那片天空吗? ……十三年前余浩全家被神秘男子杀害,将妹妹转化为尸鬼。 十三年后余浩成为一名天命师,开始踏上复仇之路,揭开一场天命师与尸鬼之间长达几千年的恩怨。 剑尘,江湖中公认的第一高手,一手快剑法出神入化,无人能破,当他与消失百年的绝世高手独孤求败一战之后,身死而亡。 死后,剑尘的灵魂转世来到了一个陌生的世界,并且飞快的成长了起来,最后因仇家太多,被仇家打成重伤,在生死关头灵魂发生异变,从此以后,他便踏上了一条完全不同的剑道修炼之路,最终成为一代剑神。 《混沌剑神》漫画将于10月1日上线腾讯动漫、微博动漫、快看漫画、爱奇艺漫画、哔哩哔哩漫画,10月1号-5号,连更5天!之后每周三、周六更新,自带金手指的剧情设定,你一定不能错过! 本书实力体系,由低至高——圣者,大圣者,圣师,大圣师,大地圣师,天空圣师,圣王,圣皇,圣帝。 了解更新情况,请关注微信公众号:xinxingxiaoyao110 或者微信公众号搜索:心星逍遥
纵情三国 我开创了御兽时代 我带着面板在诸天轮回 朱落星辰 谢邀,人在洪荒,拒绝妖皇 从奴隶开始的征服王系统 上古重启 虚梦记 我在仙界有个爹 末世觉醒之传奇人生 战天灭神 操盘手札记 卦灵路 完美特警 帝王梦记 毕业后,我竟成了契主 星球无限 异界骑士系统 从鬼灭之刃开始的虚空之力 武侠录传闻 白色房间电影 小王子电影英文发音 逆转裁判电影百度网盘 2015不伦电影 白色房间电影 我邻居是exo电影 美国电影飞虎神鹰 钟爱宝电影在线观看 蛇妖电影大全有和尚的古装 下载罪欲电影 公鸡母鸡拖拉机电影主题歌 电影残酷的欲望 电影观音山肥皂 大奥:百花?乱 电影 电影 速度与激情7 战马 War Horse - 电影 - 豆瓣 美国电影飞虎神鹰 蛇妖电影大全有和尚的古装 叶佩雯电影 我看电影夜盗珍妃墓 小王子电影英文发音 黎明演过的电影有哪些 日本电影白色房间 香港电影警匪片特征 大奥:百花?乱 电影 电影观音山肥皂 蛇妖电影大全有和尚的古装 日本电影白色房间 叶佩雯电影 蛇妖电影大全有和尚的古装 战马 War Horse - 电影 - 豆瓣 小王子电影英文发音 400天 电影介绍 我看电影夜盗珍妃墓 唐山大兄电影国语版 战马 War Horse - 电影 - 豆瓣 400天 电影介绍 逆转裁判电影百度网盘 电影观音山肥皂 400天 电影介绍 战马 War Horse - 电影 - 豆瓣 我的梦 电影 赛尔号5雷神崛起大电影完整版 电影残酷的欲望 香港电影警匪片特征 小王子电影英文发音 电影残酷的欲望 400天电影 观音山电影水下激情 窟髅电影 亚星游戏官网 亚星官网 亚星官网 亚星官网 亚星官网 东顷 我叫徐无为 长恨歌谈 我的禽与兽 武灵霸主东方晋 欧博游戏官网 百家乐官网 亚星管理平台 欧博游戏官网 亚星管理平台 白色房间电影 战马 War Horse - 电影 - 豆瓣 钟爱宝电影在线观看 我看电影夜盗珍妃墓 美国电影飞虎神鹰 电影鲜花歌曲 黎明演过的电影有哪些 蛇妖电影大全有和尚的古装 公鸡母鸡拖拉机电影主题歌 公鸡母鸡拖拉机电影主题歌 窟髅电影 逆转裁判电影百度网盘 我的梦 电影 日本电影白色房间 电影观音山肥皂 电影鲜花歌曲 在线激情电影 400天电影 大奥:百花?乱 电影 我看电影夜盗珍妃墓 逆转裁判电影百度网盘 香港电影警匪片特征 白色房间电影 白色房间电影 大奥:百花?乱 电影 大奥:百花?乱 电影 2015不伦电影 窟髅电影 我的梦 电影 日本电影白色房间