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
黑便士邮票有多少张红楼梦12钗邮票三轮虎邮票价格图片解放区邮票价格查询怎样查到国外邮票价格是多少晋绥 邮票建军邮票规格重庆长寿邮票出售1951邮票诗词歌赋邮票纪念册邮票金 2016猴票价格及图片晋绥 邮票一枚邮票大约是8什么地方2017邮票金是什么重庆长寿邮票出售诗词歌赋邮票纪念册关于邮票品相北京邮票厂进口设备北京邮票厂进口设备建军90周年邮票意义杜鹃花邮票套票价格北京邮票厂进口设备1951邮票中国邮票价格表长城8分怎样查到国外邮票价格是多少最贵的邮票图片和价格表法国打印邮票的图中国邮票1997年价格图片大全文|邮票一枚邮票大约是8什么地方我乃计都星下凡,先天便拥有阴阳眼。未出生就遭人算计,不足月被人挖出母体,先天有缺,易招恶鬼,命格犯煞,注定活不过百日。在奄奄一息之际,幸得牛四海相救,从此跟随其生活在一起,耳濡目染,终成一方守界人,自此可与神灵交流,可随意出入地府,逆天改命!嘀...嘀...嘀... 人死后灵魂究竟会魂归何处? 带着心中最后一个想法,许一安望向呈现一条直线的心电图,缓缓地闭上了双眼。 但......耳边...传来... “一安哥哥,一安哥哥。” 不,生命的旅途还远没有结束。平行时空,异世为人,不是王侯将相,没有未卜先知,唯有科学,唯有革命,你有你的孙子六韬,我有我的论持久战,论游击战。 本书又名寒门人士发家记,这个人怎么什么都懂,我在异界当龟公的那些年,天下石人一只眼,始知我命由我不由天【2021年爆火迪化流洪荒文】 穿越到洪荒世界,还是个手无寸铁的凡人,本以为靠着系统能横行洪荒,没想到系统居然还跑了,这可怎么搞? 最关键的是封神在即,这可是连圣人无法避免的天地量劫! 林轩表示,咱还是先苟着吧! 但让他没想到的是,他随手打下的鸡,居然是鲲鹏妖师! 被他逗的满脸通红的美女,是西王母和三霄娘娘! 林轩懵了,他其实真的只想苟啊!万物陨落,化身灵体。要得超生,需淬灵魂。修得魂体,方入轮回。天道合一,大道归元。入轮回,修九重,或返红尘,或往灵境、或入修真、或遁魔域、或困泥犁,或踏妖境...一个普通的人生失意青年—林夕。 结识了外来生命灵体—一个叫做“眠”的外来人。 误打误撞签订契约,为了帮助“眠”,陷入了一系列神秘的事件... 谁会想到这平静温馨的生活竟然会被发小一句话给改变…… “我看到你老婆了,在一个收费直播间里。” “你自己去看看吧!” 我是如此爱着她,可她却还不满足,究竟是七年之痒,还是从未爱过…… 一次不忠,终身不用。 余欢,我要杀了你!如果可以的话,我愿意陪你再来一次李新焰家住大福村,可家里一点也不大福大贵,穷得叮当响,父亲做投资失败,欠了全村人的债,母亲也因为意外落了残疾,腿脚不便,整个家只能靠李新焰种地支撑。      然而就在这一天,他在地里挖到了一件龙袍,从此帝王之运加持,命格改变。      村里也出现了新的风景线“让开,别挡朕的道!”      “放肆,不得忤逆朕的旨意!”      “婷婷,朕让你做妃子如何?”…… 本故事纯属虚构
狩猎吧,猎人 极品的重生人生 水墨鄂州 长乐永宁 传奇时空的我 我乃帝尊 绑定系统,然后它溜了 彩脑 无命:生涯 破釜行 清风夜陵 神秘纪 须弥之混沌 斗破八荒 穿越,人在征途 震惊!开局校花给我生了三胞胎 始源武神 世侍弑尸史 真实修行 战神陈庆之 法国打印邮票的图 1982狗生肖邮票价格表 中国邮票价格表长城8分 关于邮票品相 红楼梦12钗邮票 北京邮票厂进口设备 中国邮票价格表长城8分 法国60年代邮票值钱 怎样查到国外邮票价格是多少 1942年的邮票多少钱 建军90周年邮票意义 建军90周年邮票意义 邮票金 2016猴票价格及图片 1982狗生肖邮票价格表 黑便士邮票有多少张 关于邮票品相 文|邮票 法国打印邮票的图 重庆长寿邮票出售 三轮虎邮票价格图片 1982狗生肖邮票价格表 三轮虎邮票价格图片 重庆长寿邮票出售 纪5邮票价格 杜鹃花邮票套票价格 邮票金 2016猴票价格及图片 法国打印邮票的图 重庆长寿邮票出售 重庆长寿邮票出售 怎样查到国外邮票价格是多少 关于邮票品相 1951邮票 解放区邮票价格查询 黑便士邮票有多少张 2017邮票金是什么 建军邮票规格 解放区邮票价格查询 中国邮票价格表长城8分 2017邮票金是什么 一枚邮票大约是8什么地方 建军邮票规格 法国60年代邮票值钱 邮票有那些图片和价格 文|邮票 公司纪念邮票资格 1951邮票 建军90周年邮票意义 建军邮票规格 邮票金 2016猴票价格及图片 中国邮票1997年价格图片大全 亚星官网 亚星游戏官网 亚星官网 亚星官网 亚星游戏官网 穿越未来之无限空间 签到万年,身份被美女徒孙曝光了 伊沌 三帝行 NBA:我可能天赋比较好吧 万利官网 欧博官网 皇冠登3出租 万利官网 欧博官网 关于邮票品相 建军邮票规格 2017邮票金是什么 中国邮票1997年价格图片大全 一个炼钢工人邮票 邮票金 2016猴票价格及图片 诗词歌赋邮票纪念册 邮票金 2016猴票价格及图片 法国60年代邮票值钱 邮票有那些图片和价格 一枚邮票大约是8什么地方 1982狗生肖邮票价格表 怎样查到国外邮票价格是多少 重庆长寿邮票出售 建军邮票规格 最贵的邮票图片和价格表 中国邮票价格表长城8分 中国邮票1997年价格图片大全 公司纪念邮票资格 北京邮票厂进口设备 诗词歌赋邮票纪念册 中国邮票价格表长城8分 1982狗生肖邮票价格表 公司纪念邮票资格 重庆长寿邮票出售 1982狗生肖邮票价格表 1942年的邮票多少钱 一个炼钢工人邮票 1942年的邮票多少钱 一枚邮票大约是8什么地方