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 in Bootstrap utilizes 12 columns that render out at widths of 724px, 940px (default without responsive CSS included), and 1170px. Below 767px viewports, the columns become fluid and stack vertically.

<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

p>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="span6">
        Level 1 column
        <div class="row">
            <div class="span3">Level 2</div>
            <div class="span3">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>

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>

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: 767px) { ... }
  /* Portrait tablet to landscape and desktop */
  @media (min-width: 768px) and (max-width: 979px) { ... }
  /* 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 hiding 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
申贤俊头像袖珍头像电话虫头像平铺头像的手描头像男头像男趴着人头像手工电话虫头像虚的头像超清萌头像平次头像申贤俊头像杀非头像林的头像电话虫头像超清萌头像汽车男头像用心头像用心头像暑假头像献字头像用心头像虚的头像女生头像霸气侧面手描头像男蜘蛛萌头像平铺头像的女生头像霸气侧面四爷头像杀非头像穿越修仙界的张玄成为一大家族的少爷,测试天赋的时候发现自己竟然没有任何修行天赋。 就在张玄心灰意冷的时候突然觉醒【超级科技签到系统】! 签到就能变强! “叮,恭喜宿主签到超级量子黑翼!” “叮,恭喜宿主签到纪元神眼!” “叮,恭喜宿主签到空间虫洞启动器! “叮,恭喜宿主签到……” 科技的尽头就是神! 别人都在忙着修仙的时候,张玄已经召唤超级科技横推仙界了!爷爷是传说中的英雄, 但在一次比武中被人踢成瘸子。 爸爸是现实中的废柴, 却成功让曾经爱过的女子变成了自己的丈母娘,迎娶她女儿~~~ 还走了狗屎运,赢得比武当了船长。 我,更是放荡不羁爱自由,就是个扶不起的阿斗, 却靠着背祖传的拳谱功法,一路鬼使神差,当了国王~~~神明与人同存的世界,人类反抗神明的故事来自现代五百强企业新闻主管的黄云鹤一下子穿越回了宋徽宗时期,接管了一个即将破产的承天印刷厂。为了拯救危机,他开办开封日报,举行了开封选美大赛等一系列比赛。报纸发展,黄云鹤奉诏进宫,前往水泊梁山采访宋江,成立军情处 ,参加岳飞将军的北伐军、、、春秋大宋,且看我记者之王怎么玩转江湖!秦凡为救老婆,不得已暴露自身能看到宝物气息的能力,不断捡漏,只要是宝物,在秦凡的眼中都无所遁形,因此引起各方势力的注意,破真伪,看人心,鉴宝捡漏,玩转人生……(都市+搞笑+爽文+阴间改革) “昨晚梦到我死了,进了阎王殿。” “阎王爷让我给他的生死簿做个后台管理系统。” 一场大梦之后,余乐成为了地府现代化的主导者…… “小余啊,我之前提到的自动匹配投胎功能,进行的怎么样了。” “我一个人实在太忙了,要不您把后端那个技术拉下去问问……”不太监,不滥情,反派智商有高有低,主要人物会成长变化。有虐有爽,先苦后甜。最主要的一点,主角不是人类,他成为了人工智能,欢迎大家来看,粉丝一人送一根胡子。拥有【满级肉身】的苏叶,穿越异界,成为显魔宗疯魔院的杂役弟子! 被女魔头吊着打,获得天魔神掌。 被老魔头拿头撞,获得种魔大法。 被小魔头当沙包,获得霸王神斩。 …… 在疯魔院当杂役这些年。 有郁郁寡欢的师妹,来疯魔院供奉魔头,经苏叶指点,修成九世女帝! 有身世卑微的凡人,来疯魔院供奉魔头,经苏叶调教,成为天下共尊的魔皇! 有朝廷弃徒的皇子,来疯魔院供奉魔头,经苏叶点拨,成为横扫大陆的一代帝王! * 六十年后,魔道天榜揭示,排序魔道强者,苏叶独占鳌头! 榜单备注——神魔共主! ……2100年,地球资源即将耗尽,唯一被人类发现的最适合生存的行星火星却凭空消失,一位科学家研究新型可持续发展能源,另一些科学家研究火星消失的原因。此时又有另一派组织觉得放弃地球,在宇宙中寻找其他适合人类生存的行星,遭到了意料中的外星文明……林逸重生了,回到了人类末世的五年前,神明降世奴役人族、妖魔横行都市以人为食,人类险遭灭绝。 林逸:“还有五年,足够让我改变未来。” 娇俏校花:“林逸哥哥,不是说好的修仙吗?你这是在干什么……”
原子:理与感 社安部修真人 我在异世也当狗? 抚爱的折痕 墨阁的黑色秘密 渡仙劫乐 我们纯真的青春番外 乾之道 异世界转生体: 人工智能之傀儡大宗师 他不想做救世主 镇国利刃 三千世界大系统 我以肉身横推万界 唯争不止 居然有个高手 天师赘婿 逍遥小仙农 夺舍反派,开局被主角讨伐 奇葩医圣,顶天顶地顶空气 头像有数字 头像有姓 汽车男头像 用心头像 头像有数字 头像男成功 群头像照片 水粉男头像 蜘蛛萌头像 杀非头像 虚的头像 校服系头像 锐雯头像吧 超清萌头像 头像男趴着 手描头像男 群头像照片 蜘蛛萌头像 献字头像 申贤俊头像 头像有姓 电话虫头像 袖珍头像 林的头像 超清萌头像 锐雯头像吧 蜘蛛萌头像 袖珍头像 献字头像 蜘蛛萌头像 手描头像男 头像有姓 头像兄妹 申贤俊头像 女生头像霸气侧面 手描头像男 头像兄妹 汽车男头像 锐雯头像吧 电话虫头像 平铺头像的 样衰头像 暑假头像 校服系头像 林的头像 头像有姓 校服系头像 平铺头像的 四爷头像 人头像手工 亚星官网 亚星官网 亚星官网 亚星官网 亚星官网 哥的开挂人生 从盗墓笔记开始签到 大明武林那些事 原谅我堕落 你假装修炼一下吧,球球了! 亚星管理平台 亚星官网 万利官网 亚星管理平台 澳门葡京官网 杀非头像 校服系头像 暑假头像 手描头像男 汽车男头像 申贤俊头像 献字头像 林的头像 四爷头像 褐色头像 褐色头像 头像男趴着 申贤俊头像 锐雯头像吧 用心头像 电话虫头像 样衰头像 头像有姓 充色头像 平铺头像的 汽车男头像 袖珍头像 杀非头像 四爷头像 虚的头像 杀非头像 手描头像男 头像男趴着 头像男趴着 女生头像霸气侧面