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
丰县永和豆浆外卖电话晨铭酒店电话四云奶盖贡茶外卖电话贺州火车站货运站电话长沙金茂梅溪湖电话丰县永和豆浆外卖电话全国各机场投诉电话四云奶盖贡茶外卖电话秦皇岛亚朵酒店香玺海店电话中央大学韩国电话潮南出入境管理局电话四云奶盖贡茶外卖电话桦甸市龙兴宾馆电话潮南出入境管理局电话青阳汉庭电话号码中央大学韩国电话德克士万达电话号码御福楼电话御福楼电话威海荣成市旅行社电话喀什胡杨牧歌餐厅电话御福楼电话秦皇岛亚朵酒店香玺海店电话乌鲁木齐兄弟电玩电话凤岗到广水汽车站的电话是多少邯郸到贵阳的大巴时刻表查询电话凤岗到广水汽车站的电话是多少乌鲁木齐兄弟电玩电话威海荣成市旅行社电话桦甸市龙兴宾馆电话一位魔法高中生教你玩魔法,逆袭爽文在线开挂,魔法世界那么大,不想来看看吗原本只是个普通二次元兼游戏、军事宅的少年在机缘巧合下穿越到了正面临着逐渐崩坏的萌域,在迷茫中开启了自己的第二人生。 权力的明争暗斗,战场的鲜血与炮火。这是一个残酷的乱世,亦是一个属于英雄的乱世。 *原作:《萌战无双》(三国志系列mod)* *角色性格,设定崩坏注意* 你做过梦吗?如果有东西可以进入你的梦境,噩梦来临了……科技为刀有两面, 毁灭、创生一念间。 恶人持刀则为恶, 善人持刀则为善。 科技笼罩下的欲望狂野生长。 黑暗来临,动荡将起! 在这个天色已晚天未亮的世界中, 必然有人提刀换天明! 而在黑暗笼罩下的林清也将会成为其中的一员…… 叶多多一次意外,穿越轮回隧道,成为魔法师。 爹娘之仇,婚姻不遂,迫使他修炼武魂,成为五州大陆上响当当的魔法师。 报仇,雪恨,药物为尊,灵火为荣。 修魂力,展魂气,晋魂环,固魂骨,复仇,是非恩怨,有那不败神话! 路上碰到个老神仙非说要给我算命,最后说我五行俱全不适合这个世界,没多久,精神病院的人把他抓了回去,然而我果真如同那精神病所说,我,不适合这个世界,在他被抓没几分钟,我就穿越到了这阴阳五行世界,这里总该是属于我的世界了吧,我,莯灿鑫,将在这个世界留下我的故事!是意外吗?重生解开意外死亡之谜,一个叫欧阳宇墨的特种兵退役后惨遭陷害后重生初中1900年,二十世纪开篇,工业革命,洋务运动,百日维新,义和闹剧…… 内忧外患之下,一个庞大的东方古国,处在风雨飘摇之中,命运多舛。 就在这年,一个来历奇异的江南少年,带着现代知识和技能,一头扎进这乱世漩涡之中。这个世界本来是关于修仙的,一切都向好的发展……但是有一天魔法突然复苏了!!!惊动了修真界!短短几天修真界崩溃了!!!新的秩序诞生了。 魔气降临在地球上面,让世界发生了巨大的变化!世界的另一边…也缓缓露出水面。 世界的尽头,是什么? 世界之外有什么?是宇宙吗? 魔法复苏?这是什么情况? 魔气复苏?这又是什么惰况? 是魔法复苏、还是魔气复苏?这是福还是祸?主角该怎么去面对? 灵气复苏?魔法复苏?是魔法复苏,还是魔气复苏!究竟是什么呢?主角是人还是魔! 还是说地球原本就是一个魔法的世界! 魂穿崇祯却发现自带华夏图书馆,整顿吏治,训练新军,平内安外,科技强国第一步先从留住魏忠贤开始。 东林意图众正盈朝?可曾问过厂卫刀还利否? 鞑子于辽东意图糜烂中原?可曾听闻枪与火炮轰鸣? 东瀛时常滋扰海防?与其日日提防不如给大明添座石见银山? 知识改变世界,放牧北美,开矿澳洲,殖民印度,脚踩东欧。 枪炮铸我铁血大明,科技铸我宏图盛世。 朱由检:海内诸国,皆为臣属,有明一朝,日月不落。
汇龙潭 无知的凶手 我真的穿越了吗? 末日:最强能力者 狱世大陆 如果神仙不务正业 无情之驭 成为魔皇之后 绝处逢生懒九天 修仙:从躺平开始 有妖越界 女帝:世子才是真无敌 我在修仙界有百万粉丝 怪道 道心之崩 惟一真道 黑黯 容臭 都市之龙魂战神 人到中年 徐州迈乐迪ktv电话 安顺客运东站售票电话号码 德克士万达电话号码 长沙金茂梅溪湖电话 徐州迈乐迪ktv电话 李沧沧口汽车站电话 德克士万达电话号码 长春市导服中心电话 邯郸到贵阳的大巴时刻表查询电话 厦门奥林匹克电话 大同旅行社的电话号码 大同旅行社的电话号码 滨州电脑宽带服务电话 安顺客运东站售票电话号码 丰县永和豆浆外卖电话 长沙金茂梅溪湖电话 南宁市大东南餐馆电话 邯郸到贵阳的大巴时刻表查询电话 安源锦绣城联系电话 四云奶盖贡茶外卖电话 安顺客运东站售票电话号码 四云奶盖贡茶外卖电话 安源锦绣城联系电话 御福楼电话 中央大学韩国电话 滨州电脑宽带服务电话 徐州迈乐迪ktv电话 晨铭酒店电话 安源锦绣城联系电话 邯郸到贵阳的大巴时刻表查询电话 长沙金茂梅溪湖电话 佳木斯四丰小镇电话 贺州火车站货运站电话 丰县永和豆浆外卖电话 乌鲁木齐兄弟电玩电话 凤岗到广水汽车站的电话是多少 贺州火车站货运站电话 德克士万达电话号码 滨州电脑宽带服务电话 青阳汉庭电话号码 凤岗到广水汽车站的电话是多少 长春市导服中心电话 南昌189宾馆电话 南宁市大东南餐馆电话 潮南出入境管理局电话 佳木斯四丰小镇电话 大同旅行社的电话号码 凤岗到广水汽车站的电话是多少 滨州电脑宽带服务电话 兰海游泳馆电话 亚星官网 亚星游戏官网 亚星游戏官网 亚星官网 亚星官网 苦修之旅 三国:满朝文武全是穿越者 我没想成仙 未知镜头 我是恶魔? 亚星游戏官网 万利游戏官网 万利官网 亚星游戏官网 澳门葡京官网 四云奶盖贡茶外卖电话 桦甸市龙兴宾馆电话 喀什胡杨牧歌餐厅电话 中央大学韩国电话 李沧沧口汽车站电话 德克士万达电话号码 中央大学韩国电话 青阳汉庭电话号码 滨州电脑宽带服务电话 威海荣成市旅行社电话 徐州迈乐迪ktv电话 李沧沧口汽车站电话 安源锦绣城联系电话 四云奶盖贡茶外卖电话 御福楼电话 南宁市大东南餐馆电话 徐州迈乐迪ktv电话 厦门奥林匹克电话 秦皇岛亚朵酒店香玺海店电话 安顺客运东站售票电话号码 邯郸到贵阳的大巴时刻表查询电话 德克士万达电话号码 青阳汉庭电话号码 四云奶盖贡茶外卖电话 大同旅行社的电话号码 秦皇岛亚朵酒店香玺海店电话 南宁市大东南餐馆电话 乌鲁木齐兄弟电玩电话 晨铭酒店电话 贺州火车站货运站电话