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
优优营销软件政府网站 欣赏网络安全基础知识厦门网络推广建网站网站怎么做的网络安全防火墙网站创建流程教程微博营销的特征有哪些注册个人网站软件网络安全认证北京市重大网络安全事件多种成都网站建设微博营销的特征有哪些系统营销网络安全小课堂网站建设 杭州中国国家信息安全政策营销软件的缺陷网络营销难吗手机网站设计机构网络营销服务包括计算机信息网络安全服务资质网站制作报价明细表网站设计建设 武汉网络安全漏洞扫描宝洁网络营销案例分析网络安全态势感知技术深圳网站空间上海网站优化公司网络营销公司靠谱吗系统营销电子邮件营销是指什么意思网络安全日宣传活动李乘风悲催的被破了九世纯阳,誓要重回仙界,找到她弄个清楚明白,拥有万年感悟、帝尊心境,实力飞升如梭,李乘风不是天才,他只杀所谓的天才!一位东方的金融奇才,却因手下的背叛,被迫留在中国,为有朝一日,惩治叛徒,找回失去的东西,他“厉兵秣马”,暗暗积蓄实力,就这样,短短不到一年,他便迅速崛起,然而,这崛起之路,却因守护爱情和友情,变得跌宕起伏,由此,一场场争斗便拉开了帷幕…别条龙都是纯种的,生来高贵,而江尘只能从最底层向上爬; 别的修士可以拼法宝,势力,而江尘唯有拼命; 别人天赋异禀,而江尘则是资质平庸; 但江尘还有她!这是一个神奇的世界,要着不同的种族划分,无人类社会,全是以兽为核心价值观的一个起点,也可以理解为相似人类世界的其次元界我很庆幸自己生在21世纪,互联网的普及让我的见识与思想发生了恐怖的化学反应,我那不知从何而来的表达欲也可以表达在互联网上,第一次尝试写作后,我不得不承认我对动辄百万字的网络文学的节奏把控十分欠缺,我只得尝试碎片化的短篇小说,内容不限,想到哪就写到哪吧,希望给你带来欢乐梦在现实中成真就不是梦,现实走到尽头都是黄粱一梦!这是一个从梦开始的故事!天玑星附体的农村小伙考上大学,从此开启了奇异的经历,爱恨情仇,一段奇异的修炼之路。 高贵无比的蓝星灵魂穿越到玄骨大陆十三皇子身上 杨河慢慢地梳理着自己本世的记忆,大灵国国主十三子,庶出,幼年天赋异禀,深受父皇喜爱。 遭同父异母的兄长妒忌,挖除至尊雏骨,血脉被废,修为一落千丈,为躲避皇位争斗漩涡,避世于柳州城。 开启“随机提升”系统,普通丹药可以提升到至尊宝药,普通功法可以提升到至尊宝技,普通矿石可以提升到人人眼红的稀世珍宝。 至尊骨被挖又如何,血脉被废又如何,本王即将用“随机提升系统”和蓝星“易筋经”功法重回至尊,睥睨天下!赵牧意外穿越大秦世界,绑定最强工业系统! 只要完成任务,就可以获得奖励! 叮!完成任务,获得纺织机图纸, 叮!完成任务,获得蒸汽机图纸! 叮!完成任务,获得燧发枪图纸! 赵牧无比激动,终于可以开始工业革命了。 就在他打造了一个地球仪给秦始皇,准备说服他改革军制统一地球的时候,秦始皇拿出了一本九州图志。 北部,元朝和宋朝 东部,大明国 南部,大隋.... “这几个帝国每一个都有天人境强者坐镇!” “就凭你那个打鸟的玩意,也能让朕一统天下?” 赵牧看了看手中的地球仪和燧发枪,陷入了沉思。 一个少年闯入云海之中,在云海闯荡出一个云海传说......无业游民周眄意外获得系统,从此开启了大忽悠模式。 李白:我要做帝王师! 周眄:做那劳什子,有什么用。 钢铁侠:我要拯救地球! 周眄:还不如当维修工来得实在。
网站建设 杭州 信息安全服务资质用于哪些项目 网络营销的基础理论 网络安全日宣传活动 深圳整合营销费用 怎样做好公司网站 网站价格表 网络安全 ppt 中国网络安全产业联盟 饥饿营销的策略 软件网络安全认证 上海网站优化公司 网络安全攻击 平台 网络运营与网络营销蘑菇街网络营销方案 多种成都网站建设 网络安全 移动防御 套模板网站 厦门网络推广建网站 网站建设整合营销 公安部网络安全保卫局 备案 关于网络安全保护 广警转网络安全 hd网络信息安全 企业网络安全规划方案 如何实现网络安全 如何实现网络安全 网络营销途径都有哪些方面 丹江口网站开发 国外的信息安全事件 北京北京网站建设 邢台做网站可信赖 网站怎么做的 河南大学生信息安全 软件网络安全认证 北京市重大网络安全事件 营销型网站窗口客服 手机网站制作推广定制 云平台 信息安全 网站系统建站 怎样做好公司网站