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
腾讯 hook 网络安全网站可信佛山网站优化网站可信新媒体营销成功案例ppt网络安全攻击网站建设案例讯息阿凡达营销我眼中的营销电子商务网站建设的概要设计十四年前,陌生少年初次来到这片陌生的时空。十四年后,少年踏上修玄之路。父母离奇失踪,世界暗流涌动,北界风起云涌,且看南宫清如何乘风破万里浪,纵横玄天大陆!女警叶未明刚被纳入重案组,就沾光收到了一面锦旗——来自被拐至原芜村的女孩小光的父母。 然而,原芜村青年陆光的报警却让她陷入一个围绕名为“日绝”的女子的巨大黑色漩涡。我虽然不上朝,但并不代表我不办事 给我三十年,还你一个太平盛世这个世上有鬼吗? 真的有,而且有很多。 我叫徐艺,在我十八岁那年,我猛然发现了这个世界的真相。 几个少年重振门派的故事VR技术快速发展,一款名叫“王庭”的虚拟世界风靡一时。在王庭的世界,你可以选择平凡的种草生活,也可以享受战斗的快感,但在那之前,你要前往十大王座的万生殿,得到他们力量的馈赠……在《生化危机》抢来了火焰女皇! 在《功夫》骗到了如来神掌! 在《僵尸先生》学习了符篆秘术! 在《复仇者联盟》搜刮了铁人制造技术! …… 这个全民轮回的世界,通晓全部剧情的徐龙乃是最大赢家! 一言定生死,一语变乾坤。章子俊穿越到了土木之变后的明朝,随着京城保卫战的胜利,来到京城科考,从而展来了一系列身不由己的个人命运,本想躲避这纷乱的世界,寻找一个能快乐的田园生活,安稳渡过一生,不想在这样一个社会中,被各种各样的生活方式,儒家思想所冲垮,深陷在这样一个人治社会中,有欢乐,有迷茫,有危机,有失落,最后终究是一场空。前方是深渊,是死地,是天捱,是遍地的骸骨。 断了,前方的路断了,我难道已至终点了吗! 不,我不相信,既然前方无路,那我就走出一条路。
信息安全展 狮山做网站 怎么在网上创建网站 怎样建设网站 上海信息安全工程技术研究中心 国家信息安全服务资质证书 营销知识点 模板网站建设 个人信息安全的例子 常用的网络安全工具 网站站群 网络营销案例视频 黄山网站设计单位网络安全预案 网络营销的适用范围 名词解释网络市场营销 个人上网确保网络安全 北京网站排名制作 服装营销学百度云 网站报价书 上海网站设 新媒体营销成功案例ppt 在网站上显示地图 湛江有哪些网站建设公司 嘉兴网站备案 网络营销学徒是干嘛的? 信息安全展 教育信息安全平台 和营销下载 破坏网络信息安全罪 网络营销实战课程建议 提供做网站企业 组建网站 网络营销工程师好考吗 武汉工业网站制作 信息安全风险评估涉及( )影响和脆弱性三者之间的可能性评估 信息安全风险评估涉及( )影响和脆弱性三者之间的可能性评估 杭州品牌营销策划有限公司官网 html5响应式网站 网络安全攻击 网络信息安全协会 提供做网站企业 im 营销 代理商营销 网络营销案例视频 信息安全竞赛flag 核心网络安全小组 网络营销案例视频 家庭网络安全 19网站建设 网站建设中 上海信息安全工程技术研究中心 名词解释网络市场营销 2013年网络安全 信息安全竞赛flag 石家庄网站营销 网站资料备案照片要求2014法人现场拍照相片电子照要求 合肥做网站域名的公司 网络安全技术吧 北京网站排名制作 国家信息安全服务资质证书 im 营销 陌陌提示网络安全验证失败 创新型的顺的网站制作莱芜网站制作 服装营销学百度云 全球营销网 营销案例报告饥饿营销 内容营销的主要内容 网站报价书 内部局域网的网络安全 网站建设公司广告 百科词条营销 龙华三网合一网站建设 网站页头 信息安全计划 信息安全常见的漏洞有 新媒体营销成功案例ppt 上海建站网站简洁案例 信息安全培训资格证,-1 龙华三网合一网站建设 在网站上显示地图 饥饿营销具体意思 病毒营销的传播渠道 营销模式包含哪些内容 网络安全隐私泄露 德阳做网站 腾达网络安全密钥不匹配 营销性软文 麦肯锡 网络安全解决方案 信息安全技术实训总结 大学生信息安全知识 信息安全技术心得,-1 网络营销学徒是干嘛的? 广东信息网络安全协会 阿凡达营销 2017 网络安全 信息安全展 信息安全计划 厦门网站建设企业 网络安全评估系统 教育信息安全平台 深圳专业网站制作公司排名 百科词条营销 佛山网站优化 制作网站的公司 网络营销工程师好考吗 网络营销什么软件好使 重庆 网络安全 网站做推广需要多少钱 电子商务网站策划书 重庆网站优化 信息安全等级保护培训 网络营销实战课程建议 国内信息安全管理标准,-1 信息安全的图片 信息安全的图片 提供做网站企业 个人上网确保网络安全 云浮网站建设信息安全等级保护三级方案 网络安全审计 组建网站 怎么在网上创建网站 北京网站排名制作 网络安全攻击 企业信息安全部 网络营销目标市场案例 2013年网络安全 武汉工业网站制作 网络营销的历史起源 网络营销实战课程建议 鸭蛋营销 网络营销策划的分类 学网络安全技术到 2017网络安全日好的信息安全论坛 重庆整合营销哪家最好 如何做好个人计算机信息安全 网站注销 网站建设中 模板网站建设 信息安全的基本目标 营销的好处 网络营销学徒是干嘛的? 微博营销诺一网络公关 网站注销 html5响应式网站 网站建设案例讯息