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
郑州至临沂大客电话是多少丽波酒店KTV招聘电话峭山农庄电话哈尔滨渔上鲜电话汕头酒店用餐电话郑州至临沂大客电话是多少源深篮球场的电话是多少峭山农庄电话铜仁市汽车站投诉电话容州酒店电话仙游五星村委会电话郑州至临沂大客电话是多少云阳两江影城电话仙游五星村委会电话峭山农庄电话容州酒店电话美国旅游紧急电话号码汕头酒店用餐电话汕头酒店用餐电话k2275次列车电话淮北到无锡大巴车电话三桥和谐阳光医院电话号码铜仁市汽车站投诉电话群乐驾校电话南航打电话改签巴城便民服务中心电话哈尔滨渔上鲜电话天津462公交总站电话k2275次列车电话平川长途随车电话世人虽渺小,可是每个人都想挣脱束缚。 诸神虽伟大,可是神也总有陨落的一天。 仙侠恩怨,王朝争霸,爱恨情仇。 且看他们演绎一场不朽传奇。 “大秦算什么...寡人要率新唐的铁骑,打下一个大大的疆域!”躺在印第安部落内,手中摇晃着看不清颜色的酒杯,李承洲向着身边所有人郑重承诺!要替大秦守护江山不倒!前提..得是自己来做皇帝!自此,超脱数千年的大革命先从美洲大陆开始了!规培医生王磊应聘失败,却获得透视脏器能力,更有神级手术技巧。 幼儿误诊,即将死亡,王磊:我看到了,支气管断裂,马上手术。 主刀医生误伤主动脉,鲜血喷到天花板,王磊轻松搞定。主刀:幸亏王磊在。 农庄爆发奇怪病症,全市医生晕头转向,大佬:快去请王磊! 小小的乡卫生院逐渐成为世界医学中心,无数患者和名医云集于此,周边房价超过市中心。 这一切,都是因为一个人。 一把钥匙打开了异世的大门, 【位格】的会议拉开了最终纪元的终焉。 终局到来前,星神,主宰,旧王,时局, 六个纪元的恩怨纠葛,阴谋算计,终将迎来终结。【文中内容纯属虚构,请勿模仿和相信!!!!】 如果除去天生阴阳眼的话,我的前半生应该是普通的不能再普通了,但自从那天之后,我墨色的生活被染上了色彩。为了男人的承诺,萧晨强势回归,化身美女总裁的贴身保镖,横扫八方之敌,谱写王者传奇!   他——   登巅峰,掌生死,醒掌天下权,醉卧美人膝! —————— 小舞的微信公众号:寂mo的舞者,可以去关注哦! 小舞的QQ:1589045849,可以去加好友! 唯舞独尊①群:545765633!   天龙国皇权覆灭后百年来有三个派系组成,士族派,中立派,变革派维持着整个国家的平衡。 但因为一个二三岁的男人改变了这种平衡,他为变革派代表,一心想要铲除世家门阀让国家成为一个人人平等的国度。主要是青天日月曜神为首的曜神与雷祖天尊普化大弟子张叔夜结下仇缘,后三十六天罡 七十二地煞帮助青天日月曜神一齐将雷祖与雷将一一打退,后齐天大圣大闹天宫,三十六天罡七十二地煞为报齐天大圣旧情,不发兵救援(玉皇大帝),被玉皇大帝关押在龙虎山,后洪太尉奉孙悟空之命放走三十六天罡 七十二地煞,雷部三十六将和雷部大弟子及其左右待者并约一十八散仙私自下凡除去三十六天罡 七十二地煞,后八位散仙一一阵亡,只剩那十名散仙,那八位散仙并告知青天日月曜神七十二地煞三十六天罡被斩,青天日月曜神等一齐大怒并上报玉皇大帝下凡除雷部三十六将,玉皇大帝也大怒道:请勿伤害雷祖三人,只拿回归案,朕自会解决。青天日月曜神等并道:好,遵陛下命令。青天日月曜神等转世为人,青天日月曜神只需了宣和十年将三十六雷将 八位散仙一一诛灭。有没有想过三国时代最根源是从哪里来? 天下大势? 合久必分? 有没有想过是汉末第一导演袁绍谋篇布局了非常精妙的189年东汉皇权大崩塌...
我之大明 我真的很低调 我手上有龙印记 药神赘婿 青醒天下 虚度三十年华 重生之我是大主播 全民征战:创世神在线陪聊 我的世界:无畏 三国:人在曹营,开局赤壁 超凡:我体内寄居着邪神 一念山河烬 游山册 铸天纪 元素:我拥有混沌的能力 猎异之界 我真不是王爷 雷帝之童养夫的崛起 我的系统有点毒 灵界之下界 巴城便民服务中心电话 容州酒店电话 美国旅游紧急电话号码 汕头酒店用餐电话 丽波酒店KTV招聘电话 天津462公交总站电话 丽水福特保养电话号码 巴士二汽投诉电话 屏南外卖电话 云阳两江影城电话 中国新加坡旅游电话 中国新加坡旅游电话 群乐驾校电话 容州酒店电话 郑州至临沂大客电话是多少 南航打电话改签 谁有长沙到江垭包车司机电话 巴城便民服务中心电话 临河有小姐宾馆电话 峭山农庄电话 扬州瘦西湖服务电话 峭山农庄电话 临河有小姐宾馆电话 三桥和谐阳光医院电话号码 紫阳移动公司电话 安徽长丰双凤经济开发区凤梅社区居民委员会电话 巴城便民服务中心电话 临河有小姐宾馆电话 淮北到无锡大巴车电话 巴城便民服务中心电话 汕头酒店用餐电话 扬州瘦西湖服务电话 哈尔滨渔上鲜电话 郑州至临沂大客电话是多少 群乐驾校电话 南航打电话改签 哈尔滨渔上鲜电话 丽水福特保养电话号码 群乐驾校电话 五常车站电话号 南航打电话改签 巴士二汽投诉电话 k2275次列车电话 谁有长沙到江垭包车司机电话 仙游五星村委会电话 扬州瘦西湖服务电话 中国新加坡旅游电话 南航打电话改签 安徽长丰双凤经济开发区凤梅社区居民委员会电话 美国旅游紧急电话号码 亚星官网 亚星游戏官网 亚星游戏官网 亚星官网 亚星官网 明朝小书生 虎踞新纪元 曙光之壤 众与世界 哈利波特里的法王 葡京官网 快连下载 亚星管理平台 葡京官网 皇冠登3出租 丽波酒店KTV招聘电话 淮北到无锡大巴车电话 南航打电话改签 丽波酒店KTV招聘电话 天津462公交总站电话 五常车站电话号 天津462公交总站电话 巴城便民服务中心电话 安徽长丰双凤经济开发区凤梅社区居民委员会电话 源深篮球场的电话是多少 容州酒店电话 丽水福特保养电话号码 郑州至临沂大客电话是多少 群乐驾校电话 郑州至临沂大客电话是多少 容州酒店电话 五常车站电话号 郑州至临沂大客电话是多少 丽波酒店KTV招聘电话 五常车站电话号 汕头酒店用餐电话 平川长途随车电话 汕头酒店用餐电话 哈尔滨渔上鲜电话 扬州瘦西湖服务电话 天津462公交总站电话 安徽长丰双凤经济开发区凤梅社区居民委员会电话 群乐驾校电话 紫阳移动公司电话 仙游五星村委会电话