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
程思寒演配角的电视剧韩国电视剧幽灵国语版陈豪演律师的电视剧2017年新出电视剧2008热播电视剧排行榜程思寒演配角的电视剧看电视剧小草青青陈豪演律师的电视剧生活频道有哪些电视剧菲律宾电视剧美人鱼02欣欣和清琳的电视剧程思寒演配角的电视剧地狱少女三鼎电视剧欣欣和清琳的电视剧陈豪演律师的电视剧菲律宾电视剧美人鱼02霍尊演过电视剧吗关晓彤最近在拍的电视剧关晓彤最近在拍的电视剧王挺主演的电视剧2017什么电视剧是在森林里关于朋友妻的电视剧全集古力娜扎胡歌新电视剧鸡毛飞上天电视剧14集2008热播电视剧排行榜上古情歌 电视剧手机在线播放2017年新出电视剧飞机电视飞机电视剧王挺主演的电视剧2017地狱少女三鼎电视剧魂穿海贼世界的亚瑟,一名普普通通科学家,在这全员变态的世界如何生存? 别慌,大发明家系统为您服务!附魔台、传送石、仙豆、竹蜻蜓...各种神奇的道具应有尽有。 这就样,亚瑟成了超越贝加庞克的“天才科学家”,不仅征服了海军,还让整个世界为之疯狂。 我们的口号是“发明改变世界!”袖内光藏神武剑,他年待正天西北 这是一个纯粹的剑的世界。 少年青璃,纯净如水,晶莹如玉,藏锋守拙。 公子花华,红莲灿世,燃尽苍穹,解皆烬土。 绿叶映红花,花萼相辉,一路生花。 剑的光影中,是沉沦,还是破除。 生生不息源源不绝还是万物尽皆焚灭于流火 且在这缤纷落英中寻得一剑。 他本对这个世界充满希望,可那贼老天一次又一次的给他带来劫难,身边的人一个个离他而去。 “我早已无牵无挂,何怕这世间万难” 星运大陆,一个修习星能量求道成仙的世界。天地混沌,世界突现神秘空间,共有九重。来自第九空间的神秘力量,困住众神,颠覆世界。魔兽横行。 一个流浪子,从此走上了,修习星能量,拯救众神,使世界重新恢复和平的道路。每个人生来都会觉得自己是最与众不同的那一个,将来的自己一定会干出一番属于自己的大事业。可随着时间的推移,我们不得不面临一个残忍的事实:那就是承认自己的平凡、乃至是平庸,最终平平淡淡的过完一生。 计算机专业的项伟,一名毫不起眼的普通大学生,没有出色的外表,也没有过人的才华,甚至连性格都略显孤僻。这样一个人,或许上帝给他的“人设”就是在平淡和碌碌无为中消磨完自己的一生。 直到某一天,他无意间打开了那道“暗门”,接触到了一项原本不应该存在、但确实又真实存在的技术,他才知道,原来世界真的是多元化、信息化的。 但与此同时,他也看到了人性最本能、最原始、最露骨的一面,在每一张“文明面具”的掩盖之下,都不同程度的隐藏着一颗扭曲、冲动、疯狂而又充满欲望的内心,它暴露了人类最丑恶的一面,但却是人类文明不断前行的内在驱动力。意外穿越,自带外挂? 弱肉强食,适者生存? 修仙世界就没有人权? 看周奇如何在天玄大陆混的风生水起。 若无法,我来定。 若无正义,我来伸张。 若无将来,我来探寻。 帝令一出,万族臣服,莫敢不从…… 灵异+搞笑+器灵。 离奇失踪的合伙人让梁晓不得不接手调查社。 一个看似普通委托却让他接触到一个不一样的异世界。商贾之家的沈丛云意外卷入朝堂的争斗之中,为了自保也为了百姓安居乐业,展开了与朝中权贵的周旋,同时行走江湖为民请命。一言定生死,一语变乾坤。人类自以为的一切,完全只是被掩盖时的样子 作者将带你以一种前所未有的视角看待这世界
最牛焚尸匠 重生剑圣传 最终序列 世界灭绝之日 御灵逆天之旅 剑道崛起 成为恶蛟加点修仙 我在修仙界混日子 荒古血帝 逆路修仙传 浩瀚无境 超能异术:传奇忽悠苏大师 一品典签官 将行歌 末日灾害 一路向南之横行 小叶子的幸福生活 风都再面黑暗之时 灵魂塔之天门 我的那些年之校园风云录 赵丽颖最新现代电视剧 菲律宾电视剧美人鱼02 霍尊演过电视剧吗 关晓彤最近在拍的电视剧 赵丽颖最新现代电视剧 高鑫演的电视剧里叫曾 锦绣未央电视剧52 励志的电视剧日本 上古情歌 电视剧手机在线播放 地狱少女三鼎电视剧 古力娜扎胡歌新电视剧 古力娜扎胡歌新电视剧 鸡毛飞上天电视剧14集 菲律宾电视剧美人鱼02 李琳演过的早期电视剧 2008热播电视剧排行榜 鬼吹灯之黄皮子坟电影还是电视剧 上古情歌 电视剧手机在线播放 韩国电视剧幽灵国语版 程思寒演配角的电视剧 光荣之旅电视剧全集观看 陈豪演律师的电视剧 韩国电视剧幽灵国语版 关于朋友妻的电视剧全集 励志的电视剧日本 鸡毛飞上天电视剧14集 上古情歌 电视剧手机在线播放 韩国电视剧幽灵国语版 什么电视剧是在森林里 上古情歌 电视剧手机在线播放 关晓彤最近在拍的电视剧 光荣之旅电视剧全集观看 2017年新出电视剧 程思寒演配角的电视剧 鸡毛飞上天电视剧14集 2008热播电视剧排行榜 2016年12月上映电视剧 锦绣未央电视剧52 鸡毛飞上天电视剧14集 2016年12月上映电视剧 2008热播电视剧排行榜 《再生缘》电视剧全集 王挺主演的电视剧2017 鬼吹灯之黄皮子坟电影还是电视剧 欣欣和清琳的电视剧 光荣之旅电视剧全集观看 古力娜扎胡歌新电视剧 2008热播电视剧排行榜 整容报复的电视剧 看电视剧小草青青 亚星官网 亚星游戏官网 亚星游戏官网 亚星官网 亚星官网 恶龙英者 那裂缝的月会弥合的 唐沉记 呼喊 登神之罪 李浩然的故事第一季 亚星游戏官网 万利游戏官网 万利官网 亚星游戏官网 葡京官网 锦绣未央电视剧52 光荣之旅电视剧全集观看 整容报复的电视剧 陈豪演律师的电视剧 菲律宾电视剧美人鱼02 《再生缘》电视剧全集 菲律宾电视剧美人鱼02 上古情歌 电视剧手机在线播放 励志的电视剧日本 看电视剧小草青青 韩国电视剧幽灵国语版 关于朋友妻的电视剧全集 2017年新出电视剧 锦绣未央电视剧52 飞机电视飞机电视剧 王挺主演的电视剧2017 整容报复的电视剧 生活频道有哪些电视剧 欣欣和清琳的电视剧 《再生缘》电视剧全集 王挺主演的电视剧2017 韩国电视剧幽灵国语版 生活频道有哪些电视剧 2017年新出电视剧 韩国电视剧幽灵国语版 高鑫演的电视剧里叫曾 陈豪演律师的电视剧 高鑫演的电视剧里叫曾 看电视剧小草青青 鸡毛飞上天电视剧14集