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
长沙星沙中铁物流电话库尔勒机票代售点电话美居管家电话号码深圳中国银行电话沈阳到富锦客车的电话长沙星沙中铁物流电话新乡金海岸电话美居管家电话号码普者黑梦之南电话合江到贵阳车电话马博士十里河店电话长沙星沙中铁物流电话东方市按摩店电话马博士十里河店电话美居管家电话号码合江到贵阳车电话平和金叶宾馆电话沈阳到富锦客车的电话沈阳到富锦客车的电话醴陵到株洲的电话北京清河收费站电话?朗庭大公馆订房电话普者黑梦之南电话郑州万豪酒店预订电话上海梅岭派出所电话桂林订出租车电话是多少深圳中国银行电话包头到内蒙的火车票查询电话醴陵到株洲的电话内黄到石家庄客车电话都市文的天花板,即将迎来发行日处在人生最低谷的杨锦川惨遭女友的抛弃,接着又是和爷爷阴阳两隔,近乎崩溃的他,不小心终止了自己的生命。 都说上帝关了这扇门,就一定会为你打开一片窗,他带着前世的记忆穿越到了另一个世界,本以为是神话般的修仙世界,不料却是一个普普通通的冷兵器时代,可…看似普通的世界,隐隐中却在暗藏着什么……一身绝世传承,妙手回春! 可悬壶济世却受人白眼,惨遭诬陷? 但,是龙,当遨游九天! 一朝出水,必踏血而归! 每天稳定两更,点点收藏不迷路!我一直认为,人是有灵魂的动物。活着的时候,灵魂附于肉体,死了之后,肉体归于尘土,灵魂则脱离肉体的束缚,回归到他该去的地方。“叮!菩提树下签到成功!主人悟性提升一千点!”   “叮!练功房签到成功!主人修为提升一万年!”     “叮!神兵房签到成功!奖励主人盘古开天斧一柄!”   宁浩远开局闭关签到一万年,狂刷奖励无数,在这一万年里,他随手调教的弟子,在外界掀起一阵又一阵狂澜。   他点化的一条鲤鱼,成了妖族龙祖。   他栽种的柳树,成了仙界最强祭灵。   他家菩提树枝头的荒雀,涅槃成了神凤。   他收留的神族少女,成为一代女帝。   他随手捡的弃婴,成了举世闻名的剑仙。   ……   他本以为可以一直签到下去,谁知有一天因他太强,系统居然吓崩了!   而这时后世美女徒孙磕头求见。   “老祖宗,快出山!”   “你的徒子徒孙都被人抓走了!”   “咱们玄剑圣地,要没了!”   于是,宁浩远出山。 万界战栗!在一个平平无奇的城市里,且看它游戏人生!末世的日子不好过啊……时空裂缝出现 人类必须躲避远古生物的抓捕 同时,大量未来生物来到现在 人类该何去何从重生前,陈凡是赫赫有名的商业大佬。 重生后,陈凡是猫嫌狗厌的街头混混。 重生前,陈凡除了钱,一无所有。 重生后,陈凡除了没钱,还是啥也没有。哦,不对,多了一个老婆和孩子。 …… 站在1987年的街头,陈凡内心涌起万丈豪情。 在这猪站在风口上都能飞的年代,自己定要做出一番不一样的成绩来。 …… “陈老先生,请问您今生最大的成就是什么?” 1987,娇妻幼子,天下我有。——《陈凡传》一代战神,因失去记忆,流浪街头,却稀里糊涂成为了秦城豪门朱家的女婿。 受尽欺辱的他,受到重创,记忆恢复,王者归来。 且看他如何收拾曾经欺辱过他的宵小之辈?如何踩着那些为富不仁之徒踏上世界之巅?如何千里走单骑救父母于危难之中? 他就是令边境悍匪和国际雇佣兵闻风丧胆的龙国战神龙之刃林灿。
一眼万年ONE 网游之开局获得神级传承 仙缘无限 导线 流浪在仙界 六趣界 洪荒之飞舞的蒲公英 我在东京经营宠物店 浮生鬼道 突破云霄 我带我妹修个仙 活脱优雅 绝的成长之路 墨云之争 我成了原始人神巫 未来战警 不存在的战争 合成纪元 魔教教主张买提 重生青春之火重燃 庶子谋路 桂林订出租车电话是多少 合江到贵阳车电话 平和金叶宾馆电话 沈阳到富锦客车的电话 库尔勒机票代售点电话 包头到内蒙的火车票查询电话 济南万达品牌电话 西安出入境办理电话号码 维也纳上海五角场电话号码 东方市按摩店电话 上汤温泉度假村电话 上汤温泉度假村电话 郑州万豪酒店预订电话 合江到贵阳车电话 长沙星沙中铁物流电话 上海梅岭派出所电话 洛阳高铁站问询处电话 桂林订出租车电话是多少 澳大利亚签证电话调查的问题 美居管家电话号码 龙华市场麦当劳电话号码 美居管家电话号码 澳大利亚签证电话调查的问题 朗庭大公馆订房电话 念坛公园 电话 意大利 电话 几位 桂林订出租车电话是多少 澳大利亚签证电话调查的问题 北京清河收费站电话? 桂林订出租车电话是多少 沈阳到富锦客车的电话 龙华市场麦当劳电话号码 深圳中国银行电话 长沙星沙中铁物流电话 郑州万豪酒店预订电话 上海梅岭派出所电话 深圳中国银行电话 济南万达品牌电话 郑州万豪酒店预订电话 圣河湾鞍山店送外卖电话 上海梅岭派出所电话 西安出入境办理电话号码 醴陵到株洲的电话 洛阳高铁站问询处电话 马博士十里河店电话 龙华市场麦当劳电话号码 上汤温泉度假村电话 上海梅岭派出所电话 意大利 电话 几位 新乡金海岸电话 亚星官网 亚星游戏官网 亚星游戏官网 亚星官网 亚星官网 战国成名录 穿越!第五人格 冒险者的故事 别浪先发育 穿越来的少年宗主 亚星管理平台 万利游戏官网 万利官网 亚星管理平台 澳门葡京官网 小梅沙水上项目电话 上海梅岭派出所电话 平和金叶宾馆电话 澳大利亚签证电话调查的问题 深圳中国银行电话 洛阳高铁站问询处电话 龙华市场麦当劳电话号码 桂林订出租车电话是多少 新乡金海岸电话 济南万达品牌电话 济南万达品牌电话 深圳中国银行电话 深圳中国银行电话 小梅沙水上项目电话 龙华市场麦当劳电话号码 上海梅岭派出所电话 平和金叶宾馆电话 东方市按摩店电话 库尔勒机票代售点电话 朗庭大公馆订房电话 上汤温泉度假村电话 维也纳上海五角场电话号码 平和金叶宾馆电话 长沙星沙中铁物流电话 澳大利亚签证电话调查的问题 平和金叶宾馆电话 马博士十里河店电话 圣河湾鞍山店送外卖电话 深圳中国银行电话 醴陵到株洲的电话