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
森林探险电影观后感dy161电影网官网张已桂电影僵尸电影全是美女在一个古宅里女主是少女鬼的电影森林探险电影观后感山炮进城dvd八哥电影张已桂电影霹雳震寰宇电影胡歌新电影2015夏洛特烦恼抄袭什么电影张已桂电影2015年新上映的电影夏洛特烦恼抄袭什么电影最后的执行人 电影胡歌新电影2015夏洛特烦恼 电影天堂周润发堵神电影周润发堵神电影隆昌电影院时代影城查一部电影周润发堵神电影霹雳震寰宇电影电影怪兽影评女主是少女鬼的电影关于小三电影泰国电影恐怖办公室续集电影怪兽影评隆昌电影院时代影城2015年新上映的电影张天峰重回1993年,以90元豪博100万。 从实业入手,一招盲盒经济享誉全球。 入股双马公司,教两人玩转用户流量经济。 控股苹果集团,教乔布斯设计一款完美手机。 ...... 拥有前世记忆,赚钱非常简单。 这一世,张天峰要教未来富豪赚钱,让他们把自己送上首富的宝座!工欲善其事,必先利其器。 这一位面的大陆之初,便是存在着灵力之气和神兵之力两股力量。 灵力提高实力,神武提高战力。 修炼者将灵力修为分九转十二境: 感知境、淬体境、彻地境。 通天境、天王境、天灵境。 仙灵境、神灵境、圣灵境。 无界境、虚无境、乾坤境。 境界越高,越难突破。 稍有不慎,便是陨落。 则兵器共分为:地武、天武、灵武、仙武、神武五等。 其中可细分为;低级、中级、高级 则武学同样分为:地品、天品、灵品、神品 而其中也是由高到低分为:低级、中级、高级 身为前isa首席的林生在结束小行星危机后,意外的被其残骸砸中,在他侥幸不死之后,身边的一切事物却开始了扭曲。沈浪:划船不靠桨,全靠浪。 凭沈浪那个穷哈哈,他为什么能够得到互联网创业女神萧红绫的喜欢。 萧红绫:因为他是背后推我的男人。 凭沈浪那个穷哈哈,他为什么能够得到娱乐创业女神苏媚的喜欢。 苏媚:因为他是我背后用力的男人。 ………… 【震惊!恐怖的商业帝国创始人】大道无边,仙旅飘渺,万千修士不过是这天地间的沧海一粟罢了。   身边人的不断离去,红颜知己一一陨落,少年,终究还是那个少年,只不过是看淡了世间冷暖,尝尽人间悲欢。此刻,我为仙,便斩断天下恶鬼之道,解救苍生于水火之中。若,仙不收我,那我聂羽便为魔,杀伐四方,毁了你这所谓的天地法则,这一世,没人能够阻挡我前进的道路,就算是那生命的桎梏,也将被我一拳轰碎......。天下纷争,西京、启阳,北燕,鬼方四国争雄。西京国第一大江湖门派问刀门门主呼延燚,率天下门徒,纵横四海,征伐天下,无论是四国庙堂还是远涉江湖都无可避免地卷入其中。现代人徐宁意外穿越到大周,徐宁对现在这具身体非常满意,要颜有颜,要钱还是有颜。不过没关系,钱没了可以再赚,颜没了就真的没了。于是徐宁一步步努力,通过现代知识,银子赚得盆满钵满;通过皇帝的宠幸,仕途一路高升。这种日子,要银子有银子,要妹子有妹子,给个神仙也不换啊。无就像书名上写着的,你加载了危险游戏。 总之我得,在游戏正式开始前,给你个忠告。 呃,没错,说得就是屏幕前满脸不在乎的你... 在这里! 你不该相信任何人! OK!就这样... 总之不论你是谁,在哪里,请相信我,在看到这里的时候,你已经被卷入进了这场危险的游戏当中! 你可以试着回头,可以盯住屏幕,可以闭上眼睛... 但不论你怎么做,它们就藏在你身边,或许是卧室的床下面,或许是卫生间的镜子里(谁知道呢,它们的喜好向来与众不同)。 呃... 该死—— 它们发现我了! 看来我只能送你到这里,下面的路,你得靠自己走了! 还记得我最初说过的吗? 不要相信任何人! 包括... 从床底下朝你伸出手的我!公主要嫁我? 太后要我当面首? 东厂厂公也欣赏我? 你不会说皇帝要找我搞龙阳吧? 重申一下,我方泽喜欢女人
傲娇的恶少被女主们反杀了 震惊!开局校花给我生了三胞胎 毒龙著 小总裁老司机 我要做小区主人 太空人冒险日记 人在娘胎:隔壁女帝想踹我出去 命线 不死者的客栈 十方:是你们逼我称帝的! 剑宰仙门 彼岸途 阳归故里 天空与大地 当问剑 三国亮剑志 离开了幽村,没人和我说话 至尊之神武大陆 崩坏的诸天 神鬼莫判 道士日僵尸的电影 电影院票房干嘛 夏洛特烦恼 电影天堂 女主是少女鬼的电影 道士日僵尸的电影 男主角的养女患绝症的电影 夏洛特烦恼 电影天堂 席方平电影演员 关于小三电影 情se电影 天才眼镜狗2大电影 天才眼镜狗2大电影 边城小镇 电影 片尾曲 电影院票房干嘛 森林探险电影观后感 女主是少女鬼的电影 僵尸的黎明电影完整版 关于小三电影 选美小姐电影台词 张已桂电影 电影院票房干嘛 最后的执行人 电影 dy161电影网官网 夏洛特烦恼抄袭什么电影 胡歌新电影2015 边城小镇 电影 片尾曲 关于小三电影 dy161电影网官网 选美小姐电影台词 关于小三电影 女主是少女鬼的电影 关于素描的电影 僵尸电影全是美女在一个古宅里 森林探险电影观后感 电影怪兽影评 女主是少女鬼的电影 僵尸电影全是美女在一个古宅里 夏洛特烦恼 电影天堂 边城小镇 电影 片尾曲 最后的执行人 电影 泰国电影恐怖办公室续集 情se电影 电影复仇香港版 僵尸的黎明电影完整版 夏洛特烦恼抄袭什么电影 电影院票房干嘛 天才眼镜狗2大电影 泰国电影恐怖办公室续集 边城小镇 电影 片尾曲 山炮进城dvd八哥电影 亚星游戏官网 亚星官网 亚星官网 亚星游戏官网 亚星官网 前生债 重生:我天后老公的身份差点曝光了 界主往事 末日尸行 星际穿越之外星文明 欧博官网 亚星管理平台 澳门葡京游戏官网 欧博官网 亚星游戏官网 北京电影学院94级表演进修班 霹雳震寰宇电影 森林探险电影观后感 周润发堵神电影 僵尸的黎明电影完整版 最后的执行人 电影 dy161电影网官网 夏洛特烦恼抄袭什么电影 电影复仇香港版 山炮进城dvd八哥电影 山炮进城dvd八哥电影 张已桂电影 最后的执行人 电影 边城小镇 电影 片尾曲 夏洛特烦恼抄袭什么电影 僵尸电影全是美女在一个古宅里 2015年新上映的电影 胡歌新电影2015 选美小姐电影台词 女主是少女鬼的电影 僵尸的黎明电影完整版 道士日僵尸的电影 2015年新上映的电影 电影复仇香港版 查一部电影 北京电影学院94级表演进修班 周润发堵神电影 张已桂电影 边城小镇 电影 片尾曲 道士日僵尸的电影