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
无情亦无忧txt我的阴灵女友txt顽妃不好惹txt无限之从灵魂摆渡开始txt下载仙墓重生txt下载无情亦无忧txt演绎txt笑看天下顽妃不好惹txt衣冠禽兽txt书包网下载皇叔不可以txt烟雨令txt无情亦无忧txt极品仙界txt豪门四部曲txt下载顽妃不好惹txt皇叔不可以txt狂生问情txt阴魂txt精校阴魂txt精校少年侦探录txt穿越成狐txt我的阴灵女友txt仙墓重生txt下载男配离我远点txt下载书包网穿越成狐txt皇叔不可以txt淬血山河txt下载男配离我远点txt下载书包网绯闻女皇老石头txt少年侦探录txt天道之下的人,在追求着天道。只是,天道又是什么?人在追求什么?是谁布局百世,这天上又是谁在住,谁又是最后的棋手?且看神以凡人鬼怪为棋,而我要掀开这百世棋局!少年李宽本是李家一个低等的奴仆,却因为一次奇遇走上了修炼的道路。来到历史世界的叶南风,发现和自己想的不太一样。 万道皆修,妖魔横行。 没办法,先苟着吧。 竟意外绑定【儒道成神】系统。 “叮!您创作一首绝品诗,儒道修为+3年。” “叮!您创作一篇绝品词,奖励《天机宝术》。” “叮!您创作一本小说,奖励儒道至宝一件。” 本想一路苟到最强者的叶南风,偏偏被娘子安排科举,还不小心中了状元。 那日。 女帝登基。 叶南风看着女帝错愕不已。 “这不是我家娘子吗?”“大师兄,他们不是师父的徒弟为什么也喊你大师兄?” 苏子默看着一脸疑惑的小师弟,沉默片刻抬头望着天空幽幽叹息说道:“这你要问你几位师姐了。”重生归来,再战诸天!为保护女友而伤人的徐枫,入狱三年意外获得一身本领。 没想到出狱后,女友竟然要嫁给当年的仇人。 可怜这瞎眼的女人,本可一步登天,却选择坠入炼狱!烽火连天不休。 隐宗12年,周王朝在三国联军的铁骑下,化为废墟。一干皇亲国戚遭到屠戮,只有年方20的太子罗方靖幸存。 中原八国,各怀野心,而太子唯一的梦想就是复国。 正当罗方靖正一步一步地实施自己的复国大业的时候,他发现了一桩陈年旧事,在茫茫历史的海洋中,显得那样的不起眼,却很有可能是罗方靖所寻求的终极答案。 我,这是怎么了? 九疆大陆,万国林立。每一个国家都传承一门武决,而林默所在的国家传承有狂化武决!我是一名女大学生,因旅游误入一个叫潮泗镇的地方,并且稀里糊涂的当上了一名古玩店店长...凭空出现的玉簪,夜里的吟唱声,各怀心事的镇民...朝泗镇的背后隐藏怎样的秘密,我又该如何在这波谲云涌的局面中拨云见日...
重生之我是张鸡豪 王者:弑神永生 钟表外的平凡人生 大唐:李二冒充我父亲 从秀才到高僧 净身出户的我火爆娱乐圈 云山诀 末世之监测者 蝉光者 朗挈名单 我穿越了自己的小说 血色苍风 玄星超时代 语言方方面面 幕水萧萧浊酒寒 翼飞本纪 全球曝光:我的中二日记竟成真了 仙王赘婿 尸之界 那小师叔真帅 山村小仙医txt下载 黄帝玉壁txt下载 狂生问情txt 阴魂txt精校 山村小仙医txt下载 爱的旋律txt下载 奉子逼婚txt 末世之苍穹之主txt 绝色恩宠txt下载 极品仙界txt 衣冠禽兽txt书包网下载 黑道学生6王者重临txt笔下文学 890星魂战神txt全集下载 皇叔不可以txt 捡来的孩子有点野txt下载 仙墓重生txt下载 奉子逼婚txt 绝色恩宠txt下载 穿越成狐txt 无情亦无忧txt 黄帝玉壁txt下载 顽妃不好惹txt 我的阴灵女友txt 豪门四部曲txt下载 皇叔不可以txt 890星魂战神txt全集下载 绝色恩宠txt下载 我的阴灵女友txt 穿越成狐txt 绝色恩宠txt下载 仙墓重生txt下载 黄帝玉壁txt下载 无限之从灵魂摆渡开始txt下载 无情亦无忧txt 重生之暴君txt百度云 仙墓重生txt下载 昏昏欲睡txt 奉子逼婚txt 890星魂战神txt全集下载 昏昏欲睡txt 仙墓重生txt下载 男配离我远点txt下载书包网 少年侦探录txt 黑道学生6王者重临txt笔下文学 豪门四部曲txt下载 黄帝玉壁txt下载 衣冠禽兽txt书包网下载 无限之从灵魂摆渡开始txt下载 天域苍穹txt笔趣阁 演绎txt笑看天下 亚星官网 亚星官网 亚星官网 亚星官网 亚星游戏官网 诛暗 魔法少女的成长日记 大汉:老子千古一帝 穿越异界,我乃天命主角! 修仙就是开挂 AG真人 欧博官网 皇冠登3出租 万利官网 快连下载 捡来的孩子有点野txt下载 穿越成狐txt 豪门四部曲txt下载 豪门四部曲txt下载 绝色恩宠txt下载 爱的旋律txt下载 淬血山河txt下载 少年侦探录txt 重生之暴君txt百度云 阴魂txt精校 末世之苍穹之主txt 我的阴灵女友txt 890星魂战神txt全集下载 黄帝玉壁txt下载 绝色恩宠txt下载 绯闻女皇老石头txt 穿越成狐txt 淬血山河txt下载 阴魂txt精校 阴魂txt精校 山村小仙医txt下载 绝色恩宠txt下载 衣冠禽兽txt书包网下载 穿越成狐txt 爱的旋律txt下载 890星魂战神txt全集下载 顽妃不好惹txt 极品仙界txt 衣冠禽兽txt书包网下载 烟雨令txt