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
票务网站建设网络安全符合性评测壹像素网站微博营销广告语工控网络安全龙头公司百度信息流营销顾问池州网站制作网络营销广告网站seo诊断本地网站建设通州网站建设网络营销渠道类型昆明高端网站建设珠海企业网站建设费用网络安全中的个人信息安全深圳h5网站制作票务网站建设公安网络安全标准网络安全事件应急响应时间要求网络安全和信息安全的区别网络营销研究目的建网站需要什么网络安全防护技术应用网站的重要性解放军信息安全测评认证中心互联网营销的流程信息安全咨询 资质,-1网站设计开发的难点互联的信息安全搜索引擎营销策略分析报告关于建网站新闻凶案连连发生,旷世绝学现世,原始森林险地,让不平静的江南,更是杀气满天。听老人讲民间故事奇闻杂谈惊悚传说还有最终结果沈浪:划船不靠桨,全靠浪。 凭沈浪那个穷哈哈,他为什么能够得到互联网创业女神萧红绫的喜欢。 萧红绫:因为他是背后推我的男人。 凭沈浪那个穷哈哈,他为什么能够得到娱乐创业女神苏媚的喜欢。 苏媚:因为他是我背后用力的男人。 ………… 【震惊!恐怖的商业帝国创始人】携系统穿越大唐的赵辰本想做个咸鱼。 没事的时候,种种地、钓钓鱼。 哪想有日,一自称老李的中年男人突然跑过来,说要带赵辰回宫当太子。 赵辰:“当太子什么的没意思,不如我出技术你出钱,咱先在家打打铁!” 老李头大手一挥:“打铁好啊,锻炼身体,要钱管够。” 赵辰:“不如咱挖运河,造福百姓。” 老李头:“好,给钱。” 赵辰“不如咱铺路……” 老李头:“给钱。” 赵辰:“不如……” 老李头:“给……啥,国库空了?” 看到自己省吃俭用,积攒了十年的国库,现在竟然连老鼠都饿死几只,老李头气的大骂赵辰败家。 却不想第二天,老李头便见万国来朝,说要朝见太子殿下…… 命运无常,但是时间并不会说谎。六界纪实,十方苦难,八荒弥尘,唯道深远……灵兽人程森屮(che四声)十一岁丧母,十三岁遭灭族。程森屮,程猖,程狂兄弟三人幸存。一年后大哥程猖却操纵程森屮杀死小时密友和程猖,心灰意冷的程森屮消失了三个月后在长安佚名“山狼”靠杀人赚钱。两年后,“山狼”声名崛起无意间认识权门高氏二公子和洌氏二公,这时有人叫杀死两人。山狼不从,没曾想那人正是大哥程猖。几经挣扎后,山狼坠于程狂和卫天兰坠落的黑鹰崖。 十年后 顶级杀手——山狼,再次出现在高风舌眼前。 正义也许会迟到,但永远不会缺席。现在还有多少人知道“满城尽白发,不敢忘大唐”的安西军,仅仅一万多人,他们在内无粮草、外无援军的情况下孤守西域四十多年,哪怕面对人数几十倍的敌军,誓死守护每寸河山 裴松之注下“行法严而国人悦服,用民尽其力而下不怨。及其兵出入如宾,行不寇,刍荛者不列,如在国中。其用兵也,止如山,进退如风,兵出之日,天下震动而人心不忧”,被魏书中记载“若此人不亡,终其志意,连年思运,刻日兴谋,则凉雍不解甲,中国不释鞍”的诸葛武侯,被人说只是个政治家,不配武庙十哲 历史上唯四的百人斩之一的杨再兴,我们都知道岳飞精忠报国,项羽神勇无双,又有几人记得杨再兴小商河一战,三百对阵十二万,阵斩两千! 对正史上唯一一名被单独列传的女将军 秦良玉,几乎没有人知道,远没有基于部分人物原型改编的戏剧、小说人物穆桂英、花木兰为人铭记,人家秦良玉才是真正的巾帼英雄! 诗仙李白的出生地碎叶城位于现在的吉尔吉斯斯坦境内,难不成李白不是中国人吗! 作品背景:这是一个发生在比较落后的小县城的故事,故事中的食宿生指的是从星期天就开始住在学校直到星期五放学才回家的学生。学校管理严格,学生到了学校后,基本没有机会出校门;而且学生家庭条件都比较困难,对于一些学生来说学校节日给他们发的零食的时候就是他们在学校最快乐的时光。 正文:今天,阳光明媚,我带着我的兄弟们从食堂出发倒垃圾,为什么我会这么积极呢?当然是因为学校外面的小卖铺卖的零食太有诱惑力了...... 也不知从什么时候开始,男人的责任和压力小了。继而,出现了所谓的“X子男”,颠覆了现实生活,让人万万没想到......
网站开发公司深圳 网络安全防护技术应用 信息安全工程定义 网络安全与防火墙技术的研究 网络安全专委会 网络安全中的个人信息安全 解放军信息安全测评认证中心 效果型网站建设 工控网络安全龙头公司 国家网络安全学院最新 解放军信息安全测评认证中心 成都建网站 嘉兴 网站 制作 外销网站 学网络营销学那一块好 linux 网络安全 命令 全网营销产品套餐 企业网络安全解决方案 网店营销所带来的意义 西电的信息安全专业排名 网络营销售后服务 企业信息安全培训内容 网站描文本 品牌网站建设公司 遵义网站建设 建网站需要什么 通州网站建设 网络安全2017大检查 个人网站建设 免费 网络安全专委会 口碑营销口碑传播 网络营销渠道类型 中国中央网络安全 台山网站建设 加强网络安全管理 信息安全行业标准 网络安全周视频 信息安全等级评估 信息安全与嵌入式 网络安全周视频