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
营销平台的网络安全专栏重庆整合营销价格搜索营销公司怎么样东营网站设计运行 打开网络安全中心网站制作公司推荐网站群系统网络安全主题文稿一、一个甜品网站建设目标淮安网站设计网络安全项目计划表如皋网站制作平顶山全网营销沈阳网站优化排名沈阳信息安全培训微信营销引流温州做网站哪家好昆明企业网站建设公司清华大学 信息安全,-1网络营销推广优化网络安全的基本需求杭州 信息安全厂商信息安全电脑推荐江苏 网络安全上市公司tsrc网络安全精英卡新乡网站设计好文案网站信息安全服务行业网络安全与防火墙技术的研究视频营销软件都有什么软件秦煜魂穿大唐,激活了个说书系统,却没想到开局任务就说【长生诀】。 秦煜:在大唐说长生诀?系统你怕不是嫌我死的太慢!你咋不叫我去讲玄武门之变? 系统:那就讲玄武门之变,要么现在死! 秦煜:我也不是怕死,就是爱讲玄武门之变! 李二:听个书,结果听到揭秘玄武门之变!这厮当真是不怕死呀 从石朝太祖开国以后,历经百年,大陆风云变幻,北方的狼已露出了他的爪牙。年少的英雄们又将如何搅动风云,各种谋算藏于心中,天下终将落入谁人手?“陛下不好了!下凡捉妖的天兵天将全被打趴了!” “陛下大喜事!狱神出手了,妖怪都被打趴了!” “陛下不好了!狱神突然收手……他跑路了!” “酉时了,他…下班了!” 玉帝气得拍了拍龙辇,并且在极度愤怒的情况下愤怒了三天三夜… 三界出了个朝九晚五的楚大佬,从此画风变了。 刚破封的罗睺:三界什么时候出了这么一个猛人?我差点被锤爆! 西方教大佬:+1,现在只敢星期六日出来溜达,因为那俩天,楚大佬不上班 玉皇大帝:楚大佬求求你加个班,当个人吧!妖吞三千界,帝陨傲世间。为她凡尘一坐三千载,起身回首凡尘,往长生。这是一个总是被提起却又被带过的话题,更多的看客也是调侃。 可当这一切发生在自己身上的时候,才能清楚的体会到如此纯粹的恶意。 被辱骂,被殴打,被叫做猪猡,被夺走一切。 它叫做霸凌,是弱者聚集在一起对更弱小者实施的行为。 可如果弱者变为强者,当他们身份开始互换的时候,一切又会怎样发展呢…… 幻梦长歌几时往,长生岁月转头空。 人有前世今生,梦醒万事当头 风起吴国,一名小小少年凭借手中之剑,斩破荆棘,扶摇直上! …………从小秦悦就知道自己是鬼生下的孩子,是不吉利的,后来村里的祭祀在身上烙了一个印,可惜,这个印不仅没用,还惹来了很久以前的诅咒... 陆玄因服毒而死,却离奇重生在一片汪洋火海之中,重生的喜悦并没有持续多久,等待他的却是更加危险的世界。 且看我陆玄横刀立马,一路奔驰。该书讲的是一个社会主义国家,卡瑞特,卡瑞特这个国家为了发展经济,通过提案恢复了私有制企业,但国家并没有及时的去抑制私有企业的发展,使得国家贪污腐败过于严重,让平民受到了压迫,我们的主人公阿布司曼和一系列出现的平民,通过他们的经历让我们看到了他们悲惨的命运世间妖魔鬼怪、魑魅魍魉不及人心阴毒险恶。一场突变,一个锦衣玉食的公子,变成一无所有乞丐,看他如何一步步杀出自己的路,在这个弱肉强食的大都市里打下一片自己的天地。。。。
如何保证网络安全 国家信息安全 酒店网上营销 常州低价网站建设公司 信息安全的产品? 北京网络营销顾问 搜索营销公司怎么样 杭州 信息安全厂商 网站建设哪家好 沈阳网站优化排名 网络营销培训机构 如皋网站制作 黑龙江网站建设 信息安全相关的公众号 佛山新网站制作市场 企业网络合作营销案例 营销活动网 网络安全实习日志 营销活动网 系统信息安全要求 单位信息安全服务情况 系统信息安全要求 长沙微信营销推广平台 河北高端网站设计公司 对外推广营销策划书 天津做公司网站 佛山网站制作公司 信息安全分类 搜索引擎营销的缺点 深圳企业网站开发 当前网络安全形势 网站建设哪家好 信息安全高级专员 口啤营销 站外营销策划 中科大 信息安全专业 酒店网上营销 2016年信息安全大会柳市做网站 2017年网络安全周北京 邢台网站建设服务周到